Find the number of instructions of an algorithm
Given this algorithm (a>0, b>0) : while(a>=b){ k=1; while(a>=k*b){ a = a - k*b; k++; } } My question : I have to find the time complexity of this algorithm and to do so, I must find the number of instructions but I couldn't find it. Is there a way to find this number and if not, how can I find its time complexity ? What I have done : First of all I tried to find the number of iterations of the first loop and I found a pattern : a_i = a - (i(i+1)/2)*b where i is the number of iterations. I've spent hours doing some manipulations on it but I couldn't find anything relevant (I've found weird