OFFSET
1,1
COMMENTS
For n > 1, a(n) <= n + (-1)^n = A065190(n).
Conjecture: a(n) = n + (-1)^n for infinitely many n.
From Robert Israel, Feb 05 2016: (Start)
For m > 1, a(n) = m iff n is a divisor of m^m - 1 that is not a divisor of k^k - 1 for 1 < k < m.
In particular, a(m^m - 1) = m.
Is there any m such that this is the only n for which a(n) = m? (End)
If n > m^m - 1, then a(n) > m. - Thomas Ordowski, Oct 20 2019
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local k;
for k from 2 do if igcd(k, n) = 1 and k &^ k mod n = 1 then return k fi od
end proc:
2, seq(f(n), n=2..100); # Robert Israel, Feb 05 2016
MATHEMATICA
{2}~Join~Table[SelectFirst[Range[2, 1000], Mod[#^#, n] == 1 &], {n, 2, 80}] (* Michael De Vlieger, Feb 05 2016, corrected by Harvey P. Dale, Sep 10 2021 *)
smg1[n_]:=Module[{m=2}, While[PowerMod[m, m, n]!=1, m++]; m]; Join[{2}, Array[ smg1, 80, 2]] (* Harvey P. Dale, Aug 13 2021 *)
PROG
(PARI) a(n) = {my(m = 2); while (Mod(m, n)^m != Mod(1, n), m++); m; } \\ Michel Marcus, Feb 05 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Feb 05 2016
EXTENSIONS
More terms from Michel Marcus, Feb 05 2016
STATUS
approved