(n+1)^3-n^3 = 3n^2+3n+1
n^3-(n-1)^3 = 3(n-1)^2+3(n-1)+1
...
..
2^3-1^3 = 3*1^2+3*1+1
把上面n個式子相加得:(n+1)^3-1 = 3* [1^2+2^2+...+n^2] +3*[1+2+....+n] +n
所以S= (1/3)*[(n+1)^3-1-n-(1/2)*n(n+1)] = (1/6)n(n+1)(2n+1)