The recursive relation is equivalent to
3an+1−1=21(9an2−6an+1),n=1,2,…
Let xn=3an−1, n=1,2,…, and get x1=8=23,
xn+1=21xn2,n=1,2,…
Let xn=2yn, y1=3, n=1,2,…, and obtain
yn+1=2yn−1,n=1,2,…
It follows yn=2n+1, n=1,2,…, hence xn=22n+1, and we get
an=31(22n+1),n=1,2,…
If n=3k, then
22⋅3k=43k=(3+1)3k≡1(mod 3k+1)
hence
(23k−1)(23k+1)≡0(mod 3k+1)
But, we have
23k−1=(3−1)3k−1≡−2(mod 3k+1)
and we obtain
23k+1≡0(mod 3k+1)
hence
23k≡−1(mod 3k+1).
It follows 23k=3k+1m−1, for some odd integer m, hence
223k+1+1=23k+1m+1=(3−1)3k+1m+1≡(−1)3k+1m+1(mod 3k+1)≡0(mod 3k+1)
We obtain 3k+1∣22n+1, hence 3k∣an, that is n∣an.