OFFSET
1,3
COMMENTS
According to Kurlberg et al. (who quote Crocker and Somer), for primes p, the count is between floor(sqrt((p-1)/2)) and 3p/4 + O(p^(1/2 + o(1))).
Note that the subtraction is not done mod n. - Robert Israel, Dec 17 2014
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
Roger Crocker, On residues of n^n, Amer. Math. Monthly, 76 (1969), 1028-1029.
Pär Kurlberg, Florian Luca, and Igor Shparlinski, On the fixed points of the map x -> x^x modulo a prime, arXiv:1402.4464 [math.NT], 2014.
Lawrence Somer, The residues of n^n modulo p, The Fibonacci Quart., 19 (1981), 110-117.
EXAMPLE
For n = 5 the a(5) = 4 values are 1-1=0, 4-2=2, 2-3=-1, 1-4=-3. - Robert Israel, Dec 17 2014
MAPLE
f:= n -> nops({seq((x &^ x mod n - x) , x = 1 .. n-1)}):
seq(f(n), n=1..100); # Robert Israel, Dec 17 2014
MATHEMATICA
fs[p_] := Module[{x = Range[p - 1]}, Length[Union[PowerMod[x, x, p] - x]]]; Table[fs[n], {n, 100}]
PROG
(PARI) a(n) = #Set(vector(n-1, j, lift(Mod(j, n)^j) - j)); \\ Michel Marcus, Dec 16 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Feb 19 2014
STATUS
approved