Because12+22+32+...+n 2 = n (n+1) (2n+1)/6.
So in question 2, n= 100, then it is12+2 ...+99 2+100 2 =100 *10/* 2065438.
Appendix:
The derivation process of12+2+3 2+...+N2 = n (n+1) (2n+1)/6;
Using cubic difference formula
n^3-(n- 1)^3= 1*[n^2+(n- 1)^2+n(n- 1)]
=n^2+(n- 1)^2+n^2-n
=2*n^2+(n- 1)^2-n
2^3- 1^3=2*2^2+ 1^2-2
3^3-2^3=2*3^2+2^2-3
4^3-3^3=2*4^2+3^2-4
......
n^3-(n- 1)^3=2*n^2+(n- 1)^2-n
All the equations add up.
n^3- 1^3=2*(2^2+3^2+...+n^2)+[ 1^2+2^2+...+(n- 1)^2]-(2+3+4+...+n)
n^3- 1=2*( 1^2+2^2+3^2+...+n^2)-2+[ 1^2+2^2+...+(n- 1)^2+n^2]-n^2-(2+3+4+...+n)
n^3- 1=3*( 1^2+2^2+3^2+...+n^2)-2-n^2-( 1+2+3+...+n)+ 1
n^3- 1=3( 1^2+2^2+...+n^2)- 1-n^2-n(n+ 1)/2
3( 1^2+2^2+...+n^2)=n^3+n^2+n(n+ 1)/2=(n/2)(2n^2+2n+n+ 1)
=(n/2)(n+ 1)(2n+ 1)
1^2+2^2+3^2+...+n^2=n(n+ 1)(2n+ 1)/6