# Tight Big O - doubly nested loop

How would I go about calculating the Big O of this function?

I am told the answer is $O(n^{12})$ but cannot determine why it is not $O(n^9)$.

public int frag (int n) {
int sum = 0;
for (int i = 0; i < n * n * n; i++)
for(int j = i * i * i; j > 0; j--)
sum = sum + 2;
return sum;
}

-
For some basic information about writing math at this site see e.g. here, here, here and here. – Julian Kuelshammer Dec 4 '12 at 23:48

The inner loop executes $i^3$ times, adding $2i^3$ to $sum$. So the outer loop gives $sum=\sum_{i=0}^{n^3-1} 2i^3=2\left(\frac {(n^3-1)n^3}2\right)^2$ from Faulhaber's formula