【Analysis】For p∣n,p being a prime, consider a1,a2,⋯,ap−1.
If some of the ai≡0,1(modp), then
ai+1=2ai2−1≡±1(modp),
ai+2≡1(modp).
It can be deduced that ap≡±1(modp).
Thus, p † ap.
Also, akp≡1(modp), so an≡1(modp).
Therefore, p∤an.
If a1,a2,⋯,ap−1 have no remainders 0 and 1 modulo p, then there must be
ai≡aj(modp)(i=j).
Thus, ai+1≡aj+1(modp), and ai,ai+1,⋯,ap−2,ap−1 are not divisible by p, with a congruence period of j−i.
Hence, an≡ak(j−i)+r≡ar(modp)(0⩽r⩽j−i−1).
If r=0, then an≡aj−i(modp).
Therefore, an=≡(modp).
If n=p1α1p2α2⋯pkαk, then pi∤an.
Thus, (n,an)=1.