i*******n 发帖数: 166 | 1
consider the sum of following numbers
1
1 2
1 2 3
.....
1 2 3 .... n
for the i-th row, the sum is i(i+1)/2
for the i-th column, the sum is i*(n-i+1)
Since sum row by row = sum column by column, we have
n n
--- ---
\ \
/ i(i+1)/2 = / i*(n-i+1).
--- ---
i=1 i=1
We then have
n n
--- ---
\ 1 \
/ i^2 = - (2n+1) / i =n(n+1)(2n+1)/6.
--- 3 | d*z 发帖数: 150 | 2 这种解法不够一般化
我一般喜欢将一个表达式化成差分形式,
比如计算1+2^2+...+n^2,
我们可以设想,如果能够将通项n^2写成f(n+1)-f(n)的形式
那么1+2^2+...+n^2 = f(n+1)-f(1).
如果f(n)是n的三次多项式,f(n+1)-f(n)就会是二次,所以可以假设
f(n)=a * n^3 + b*n^2+c*n +d
f(n+1)=a*(n+1)^3 + b(n+1)^2 + c(n+1) + d
代入方程
f(n+1)-f(n)=n^2,就可以计算出a,b,c (d任意) |
|