OFFSET
1,5
COMMENTS
a(n) is the number of primitive roots g of p=prime(n) for which an x with 0 < x < p exists such that g^x == x (mod p). - Robert Israel, May 12 2017 [Corrected by Tim Peters (following an observation made by José Hernández), Apr 16 2024]
The number x is called a fixed point of the discrete logarithm with base g.
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
M. Levin, C. Pomerance, and K. Soundararajan, Fixed Points for Discrete Logarithms. In: G. Hanrot, F. Morain, and E. Thomé (eds), Algorithmic Number Theory. ANTS 2010. Lecture Notes in Computer Science, vol 6197. Springer, Berlin, Heidelberg (2010).
Math Overflow, Fixed points of g^x (modulo a prime).
MAPLE
g:= proc(n) local p, r, S, R, x;
p:= ithprime(n);
r:= numtheory:-primroot(p);
S:= select(t -> igcd(t, p-1) = 1, {$1..p-1});
R:= map(s -> r &^ s mod p, S);
for x from 2 to p-2 do
R:= remove(t -> (t &^ x - x mod p = 0), R);
od;
numtheory:-phi(p-1)-nops(R);
end proc:
g(1):= 1:
map(g, [$1..100]); # Robert Israel, May 12 2017
MATHEMATICA
Table[p = Prime[n]; Length[Select[PrimitiveRootList[p], MemberQ[PowerMod[#, Range[p-1], p] - Range[p-1], 0]&]], {n, 1, 100}] (* updated by Jean-François Alcover, Oct 11 2020 *)
PROG
(PARI) apply( {A174407(n, p=prime(n), s=0)=for(r=1, p-1, my(g=Mod(r, p)); if(znorder(g)==p-1, for(x=1, p-1, g^x==x && s++ && next(2)))); s}, [1..99]) \\ quite inefficient code, for illustration. - M. F. Hasler, Apr 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Mar 18 2010
EXTENSIONS
Definition edited, and a(1) and a(2) inserted, by Robert Israel, May 12 2017
STATUS
approved