OFFSET
1,1
COMMENTS
a(n) is the smallest k such that n^(k-1) == 1 (mod k) and p-1 does not divide k-1 for every prime p dividing k.
All listed terms are semiprime and squarefree, except a(26) = 475 = 5^2*19.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
MATHEMATICA
Table[Block[{k = 2}, While[Nand[PowerMod[n, k - 1, k] == 1, AllTrue[FactorInteger[k][[All, 1]] - 1, Mod[k - 1, #] != 0 &]], k++]; k], {n, 50}] (* Michael De Vlieger, Jul 20 2018 *)
PROG
(PARI) isok(k, n) = {if (!isprime(k) && Mod(n, k)^(k-1) == 1, f = factor(k)[, 1]; for (j=1, #f~, if (!((k-1) % (f[j]-1)), return (0)); ); return (1); ); return (0); }
a(n) = {my(k=2); while(!isok(k, n), k++); k; } \\ Michel Marcus, Jul 17 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jul 17 2018
EXTENSIONS
More terms from Michel Marcus, Jul 17 2018
STATUS
approved