%I #119 Jan 21 2023 14:28:39
%S 2,1093,5,20771,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,
%T 71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,
%U 11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71,3,11,71
%N a(n) = first odd Wieferich prime to base a(n-1) for n > 1, with a(1) = 2.
%C a(2) = 1093 since 1093 is the smallest odd Wieferich prime to base 2.
%C a(3) = 5 since 5 is the smallest odd Wieferich prime to base 1093.
%C Subsequence starting at a(5) is periodic with period 3, repeating the terms {3, 11, 71}.
%C Do values for a(1) exist such that the resulting sequence does not eventually become periodic?
%C The following table lists the values for a(1) and the resulting cycles those values produce. An entry of the form x-y in first column means all terms from x up to and including y reach the corresponding cycle. An entry of the form {t_1, t_2, t_3, ..., t_n} in second column means the listed terms form a repeating cycle. Entries in second column without curly braces mean the listed terms are reached in order and the term following the last listed term is unknown. A question mark means no further terms have been found in the resulting trajectory of a(1).
%C a(1) | resulting terms
%C ----------------------------------
%C 2-13, 15-20, | {3, 11, 71}
%C 22-28, 30-40, |
%C 42-46, 48-59, |
%C 62-71, 73-82, |
%C 84-87, 89-118, |
%C 120-132, 134-136,|
%C 138, 140-155, |
%C 157-185, 188, |
%C 190-195, 197-199 |
%C |
%C 14, 41, 60, 137, | 29
%C 196 |
%C |
%C 21, 29, 47, 61, | ?
%C 72, 139, 186-187 |
%C |
%C 83 | {4871, 83}
%C |
%C 88 | 2535619637, 139
%C |
%C 119 | 1741
%C |
%C 133 | 5277179
%C |
%C 156 | 347
%C |
%C 189 | 1847
%C |
%C Notes
%C ------
%C The terms of the cycle reached from 83 correspond to A124121(4) and A124122(4), so those terms form a double Wieferich prime pair.
%H R. Fischer, <a href="http://www.fermatquotient.com/FermatQuotienten/FermQ_Sorg">Thema: Fermatquotient B^(P-1) == 1 (mod P^2)</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).
%F From _Wesley Ivan Hurt_, Jun 30 2016: (Start)
%F G.f.: x*(2+1093*x+5*x^2+20769*x^3-1090*x^4+6*x^5-20700*x^6) / (1-x^3).
%F a(n) = a(n-3) for n>7.
%F a(n) = (85 - 52*cos(2*n*Pi/3) + 68*sqrt(3)*sin(2*n*Pi/3))/3 for n>4. (End)
%p 2,1093,5,20771,seq(op([3, 11, 71]), n=5..50); # _Wesley Ivan Hurt_, Jun 30 2016
%t Join[{2, 1093, 5, 20771},LinearRecurrence[{0, 0, 1},{3, 11, 71},66]] (* _Ray Chandler_, Aug 25 2015 *)
%o (PARI) i=0; a=2; print1(a, ", "); while(i<100, forprime(p=2, 10^6, if(Mod(a, p^2)^(p-1)==1 && p%2!=0, print1(p, ", "); i++; a=p; break({n=1}))))
%o (Magma) [2, 1093, 5, 20771] cat &cat [[3, 11, 71]^^30]; // _Wesley Ivan Hurt_, Jun 30 2016
%Y Cf. A001220, A124121, A124122, A174422, A244546.
%K nonn,easy
%O 1,1
%A _Felix Fröhlich_, Jun 29 2014