若d=2,an=a4+(n-4)d=2n-3,n∈N+;
若d=-2,an=a4+(n-4)d=13-2n,n∈N+.
方法二 设等差数列的公差为d,
则由a1+a4+a7=15,得
a1+a1+3d+a1+6d=15,
即a1+3d=5. ①
由a2a4a6=45,
得(a1+d)(a1+3d)(a1+5d)=45,
将①代入上式,得
(5-2d)×5×(5+2d)=45,
即(5-2d)(5+2d)=9, ②
联立①②解得a1=-1,d=2或a1=11,d=-2,
即an=-1+2(n-1)=2n-3,n∈N+;
或an=11-2(n-1)=-2n+13,n∈N+.
引申探究
1.在例2中,不难验证a1+a4+a7=a2+a4+a6,那么,在等差数列{an}中,若m+n+p=q+r+s,m,n,p,q,r,s∈N+,是否有am+an+ap=aq+ar+as?
解 设公差为d,则am=a1+(m-1)d,
an=a1+(n-1)d,
ap=a1+(p-1)d,
aq=a1+(q-1)d,
ar=a1+(r-1)d,
as=a1+(s-1)d,
∴am+an+ap=3a1+(m+n+p-3)d,
aq+ar+as=3a1+(q+r+s-3)d,
∵m+n+p=q+r+s,