a(n+1) = -a(n) + 2n = -a(n) + (n+1) + n - 1,
a(n+1) -(n+1) = -[a(n)-n] - 1 = -[a(n)-n] -1/2 -1/2,
a(n+1) - (n+1) + 1/2 = -[a(n) - n] - 1/2 = -[a(n) - n - 1/2],
{a(n) - n - 1/2}是首项为a(1) - 1 - 1/2 = -1/2,公比为(-1)的等比数列.
a(n) - n - 1/2 = (-1/2)(-1)^(n-1) = (1/2)(-1)^n,
a(n) = n + 1/2 + (1/2)(-1)^n = n + [ 1 + (-1)^n]/2
啊,是求s(20)哈.那就不用那么复杂鸟.
a(n) + a(n+1) = 2n,
a(2n-1) + a(2n-1+1) = a(2n-1)+a(2n) = 2(2n-1) = 4n - 2 = 4(n-1) + 2,
s(2n) = [a(1)+a(2)] + [a(3)+a(4)] + ...+ [a(2n-1)+a(2n)] = 2n(n-1) + 2n = 2n^2.
s(20) = 2*(10)^2 = 200.