an+1=an+2n-1
an+1-an=2n-1
an-a(n-1)=2(n-1)-1
a(n-1)-a(n-2)=2(n-2)-1
a(n-2)-a(n-3)=2(n-3)-1
.
a3-a2=2(2-1)-1=1
a2-a1=2(1-1)-1=-1
以上等式相加得
an-a1=2(n-1)-1+2(n-2)-1+2(n-3)-1+.+1-1
=[-2+2(n-1)]*(n-1)/2-n*1
=2(n-2)*(n-1)/2-n
=(n-2)*(n-1)-n
=n^2-3n+2-n
=n^2-4n+2
an=n^2-4n+2+a1
=n^2-4n+2+20
=n^2-4n+22