A269111 a(n) = length of the repeating part of row n of A288097.
2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2
Offset: 1
Examples
The trajectory of 31 starts 31, 7, 5, 2, 1093, 2, 1093, 2, 1093, ...., entering a repeating cycle of length 2, so a(11) = 2.
Links
- R. Fischer, Thema: Fermatquotient B^(P-1) == 1 (mod P^2)
Programs
-
Mathematica
Table[Length@ DeleteCases[Values@ PositionIndex@ NestList[Function[n, Block[{p = 2}, While[! Divisible[n^(p - 1) - 1, p^2], p = NextPrime@ p]; p]], Prime@ n, 12], ?(Length@ # == 1 &)], {n, 12}] (* _Michael De Vlieger, Jun 06 2017, Version 10 *)
-
PARI
a039951(n) = forprime(p=1, , if(Mod(n, p^2)^(p-1)==1, return(p))) trajectory(n, terms) = my(v=[n]); while(#v < terms, v=concat(v, a039951(v[#v]))); v a(n) = my(p=prime(n), i=0, len=2, t=trajectory(p, len), k=#t); while(1, while(k > 1, k--; if(t[k]==t[#t], return(#t-k))); len++; t=trajectory(p, len); k=#t) \\ Felix Fröhlich, Jan 14 2017
Extensions
Definition simplified by Felix Fröhlich, Jun 05 2017
Comments