Solution:
We claim that an=F2n−12, where Fn is the nth Fibonacci number. For the base case, we compute the first four values:
a1=12=F12,a2=7⋅1−1−2=22=F32a3=7⋅4−1−2=52=F52,a4=7⋅25−4−2=132=F72.
Now assume the statement holds for all 1≤k≤n for n≥4. For the inductive step, we subtract an=7an−1−an−2−2 from an+1=7an−an−1−2 to get
an+1=8an−8an−1+an−2=8F2n−12−8F2n−32+F2n−52.
But we find that for any m≥2,
Fm−2=Fm−Fm−1=Fm−(Fm+1−Fm)=2Fm−(Fm+2−Fm)=3Fm−Fm+2
Substituting this in first with m=2n−3 and then m=2n−1 gives
an+1=8F2n−32−8F2n−12+(3F2n−3−F2n−1)2=(3F2n−1−F2n−3)2=F2n+12
which completes the induction.