∵nan+1=(n+1)an+2,
∴等式两边同时除以n(n+1),
得
an+1
n+1 =
an
n +
2
n(n+1) =
an
n +2(
1
n -
1
n+1 ),
即
a2
2 ?
a1
1 =2(1?
1
2 ),
a3
3 -
a2
2 =2(
1
2 -
1
3 ),
…
an
n -
an?1
n?1 =2(
1
n?1 -
1
n ),
等式两边同时相加得
an
n -
a1
1 =2(1-
1
n )=2-
2
n ,
∵a1=2,
∴
an
n =4-
2
n ,
则an=4n-2,当n=1时,也满足条件,
故an=4n-2,
故答案为:an=4n-2