login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A330342
a(n) is the smallest k such that b^(n-1) == b^k (mod n) for all integers b.
0
0, 1, 2, 3, 4, 1, 6, 3, 2, 1, 10, 3, 12, 1, 2, 7, 16, 5, 18, 3, 2, 1, 22, 3, 4, 1, 8, 3, 28, 1, 30, 7, 2, 1, 10, 5, 36, 1, 2, 3, 40, 5, 42, 3, 8, 1, 46, 7, 6, 9, 2, 3, 52, 17, 14, 7, 2, 1, 58, 3, 60, 1, 2, 15, 4, 5, 66, 3, 2, 9, 70, 5, 72, 1, 14, 3, 16, 5, 78, 7, 26, 1, 82, 5, 4, 1, 2, 7, 88, 5
OFFSET
1,3
COMMENTS
Note that (n-1) == a(n) (mod lambda(n)), where lambda(n) = A002322(n).
For n > 1, a(n) = lambda(n) if and only if n is a prime or a Carmichael number. For n <> 1 and 4, a(n) = n-1 if and only if n is a prime.
For n > 2, a(n) = 1 if and only if n is a squarefree 2-Knodel number.
For n > 3, a(n) = 2 if and only if n is a 3-Knodel number.
FORMULA
a(n) = A(n) if A(n) >= A051903(n) or a(n) = A002322(n) + A(n) otherwise, where A(n) = ((n-1) mod A002322(n)).
MATHEMATICA
a[n_] := Module[{k = 0}, While[!AllTrue[Range[n], PowerMod[#, n - 1, n] == PowerMod[#, k, n] &], k++]; k]; Array[a, 100] (* Amiram Eldar, Dec 11 2019 *)
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Dec 11 2019
EXTENSIONS
More terms from Amiram Eldar, Dec 11 2019
STATUS
approved