∵a(n+2)=2a(n+1)-an+2
∴a(n+2)-a(n+1)=a(n+1)-an+2
设a(n+2)-a(n+1)=b(n+1)
a(n+1)-an=bn
b(n+1)=bn+2
b(n+1)-bn=2
数列{bn}成首项b1=a2-a1=1,公差d=2的等差数列
∴bn=1+2(n-1)=2n-1
即a(n+1)-an=2n-1
a2-a1=1
a3-a2=3
a4-a3=5
an-a(n-1)=2n-3
两边同时相加得
an-a1=1+3+5+.+2n-3
an-1=n(1+2n-3)/2
an=n(n-1)+1
=n²-n+1