OFFSET
1,6
EXAMPLE
a(4) = 1 because not 2^2 = 2 (mod 4) and 3^3 = 27 == 3 (mod 4), where 2 and 3 are primes p <= 4.
PROG
(Magma) [(IsPrime(n) select 1 else 0) + #[p: p in PrimesUpTo(n) | Modexp(p, p, n) eq p]: n in [1..90]];
(PARI) a(n) = #select(x->(Mod(x, n)^x == x), primes([1, n])); \\ Michel Marcus, May 23 2025
(Python)
from sympy import sieve
def a(n): return int(n in sieve) + sum(1 for p in sieve.primerange(1, n+1) if pow(p, p, n) == p)
print([a(n) for n in range(1, 91)]) # Michael S. Branicky, May 23 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, May 22 2025
STATUS
approved
