time complexity

Hi,

Can you help me figure out time complicity of this code:
func(n)
s←0;
for i←n to n^3
do
j←1;
while j < i^2
do
j←j×2;
s←s+j−i;
return(s);

thanks
Outer loop runs n3 times. Each iteration of outer loop results in i2 iterations of inner loop. So the number of times they run in total is the sum 12 -> n3^2
Formula to get this sum:
http://www.trans4mind.com/personal_development/mathematics/series/sumNaturalSquares.htm
Topic archived. No new replies allowed.