I am working on this algorithm and I am supposed to select a notation for the number of times the statement x = x + 1 is executed in the algorithm:

if each integer 1 + 2 + ... n <= n + n + ... n = n * n * n = n^3 for all n >= 1.Code:for i = 1 to n for j = 1 to n for k = 1 to i x = x + 1

it follows that

1 + 2 + ... n = O(n^3)

My question here is did I explain myself correctly to get O(n^3)?