OFFSET
1,1
EXAMPLE
The trajectory of 220 enters the cycle {38, 39} after one step, so 220 is a term of the sequence.
MATHEMATICA
Select[Range@ 3000, Function[k, ! MemberQ[NestWhileList[Function[n, Block[{j = 1}, While[GCD[n, j] > 1 || PrimeQ@ j || PowerMod[n, j - 1, j] != 1, i = j++]; j]], k, # != 15 &, 1, 100], 15]]] (* Michael De Vlieger, Jun 06 2017, after Robert G. Wilson v at A090086 *)
PROG
(PARI) a090086(n) = forcomposite(c=1, , if(Mod(n, c)^(c-1)==1, return(c)))
trajectory(n, terms) = my(v=[n]); while(#v < terms, v=concat(v, a090086(v[#v]))); v
is(n) = my(len=2, t=trajectory(n, len), k=#t); while(1, k--; if(t[k]==t[#t], if(t[#t]!=14 && t[#t]!=15, return(1), return(0))); if(k==1, len++; t=trajectory(n, len); k=#t))
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Jun 04 2017
STATUS
approved