Solution:
We rewrite the recurrence relation as
4anan+1(n+2)an−1+anan+1an+21=4an+1an+2(n+3)an⟺(n+2)an+2=an−1(n+3)an2−4
for n≥3. Setting n=2 in the initial relation we obtain 4(a1+4)=5a1a22, implying that a1∣16 and 5∣a1+4. Therefore a1=16 and a2=1 or a1=1 and a2=2.
Case 1. Let a1=16 and a2=1. Then 5a5=6a32−4, a3a6=18 and 7a7=2a52−1 for n=3,4 and 5, respectively. Since a3≡±2(mod5) and a3 as a divisor of 18 we conclude that a3=3 or a3=18. The direct check of both values shows no solutions in this case.
Case 2. Let a1=1 and a2=2. Then n=3 and n=4 give 5a5+2=3a32 and a3a6=18, respectively. Again a3≡±2(mod5) and we see that a3=3 and a6=6 or a3=18 and a6=1. In the second case we obtain a5=194 which gives a contradiction with 8a8=a59a62−4.
In the first case a5=5 and hence the only possible values are ai=i for i=1,2,…,6. Now easy induction shows that an=n for all n.