等差数列
S(n) = a(1) + a(2) +...+ a(n-1) + a(n) =(n/2)·[ a(1) + a(n) ]=(n/2)·[2· a(1) +d(n-1)]=n· a(1) +[n(n-1)d]/2
When n is an odd number, then S(n) =(n/2)·n
等比数列
G(n) = g(1) ·r^(n-1)
S(n) = g(1) + g(2) +...+ g(n-1) + g(n)
When r<0 or r>1, S(n) ={ g(1) ·[1-r^(n)]}/(1-r)
When 0<r<1, S(n) = g(1) /(1-r)
网友评论