A385729 Number of nonnegative values s < n such that (-s) == (-s)^s == s^s (mod n).
1, 1, 1, 0, 1, 2, 1, 0, 1, 2, 2, 1, 3, 3, 1, 0, 1, 2, 2, 1, 3, 3, 1, 1, 1, 4, 1, 1, 2, 4, 1, 0, 2, 2, 4, 1, 2, 3, 3, 1, 1, 4, 3, 1, 1, 3, 1, 1, 1, 2, 1, 2, 2, 2, 3, 2, 3, 3, 2, 3, 2, 3, 1, 0, 3, 5, 2, 1, 2, 6, 3, 1, 1, 4, 3, 1, 3, 4, 2, 1, 1, 3, 2, 3, 3, 4, 1, 1, 1, 4, 4, 2, 3, 3, 2, 1, 1, 2, 3, 1
Offset: 1
Keywords
Programs
-
Magma
[1] cat [#[s: s in [0..n-1] | Modexp(s, s, n) eq n-s and Modexp(-s, s, n) eq n-s]: n in [2..100]];
-
Mathematica
a[n_] := Count[Range[0, n-1], ?(PowerMod[#, #, n] == PowerMod[-#, #, n] == Mod[-#, n] &)]; Array[a, 100] (* _Amiram Eldar, Jul 15 2025 *)
-
PARI
a(n) = sum(s=0, n-1, (-s == Mod(s, n)^s) && (-s == Mod(-s, n)^s)); \\ Michel Marcus, Jul 09 2025