OFFSET
1,2
COMMENTS
From Robert Israel, Aug 01 2025: (Start)
a(n) = ceiling(n/2) + the number of odd s < n such that 2 * s^s == 0 (mod n).
If n is divisible by 4, there are no such s, so a(n) = n/2.
If n == 2 (mod 4), then s = n/2 works, so a(n) >= n/2 + 1. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local s;
ceil(n/2) + nops(select(s -> 2 * s &^ s mod n = 0, [seq(s, s = 1 .. n-1, 2)]))
end proc:
map(f, [$1..100]); # Robert Israel, Aug 01 2025
MATHEMATICA
a[n_] := Count[Range[0, n-1], _?(PowerMod[#, #, n] == PowerMod[-#, #, n] &)]; Array[a, 100] (* Amiram Eldar, Jul 31 2025 *)
PROG
(Magma) [#[s: s in [0..n-1] | Modexp(s, s, n) eq Modexp(-s, s, n)]: n in [1..100]];
(PARI) a(n) = sum(s=0, n-1, Mod(s, n)^s == Mod(-s, n)^s); \\ Michel Marcus, Aug 07 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 31 2025
STATUS
approved
