A380858 a(n) is the number of primes p <= n such that p^(p + n) == p (mod p + n).
0, 0, 2, 1, 2, 1, 1, 2, 1, 3, 2, 3, 1, 3, 2, 3, 2, 4, 1, 3, 1, 3, 1, 6, 0, 6, 1, 4, 2, 7, 1, 3, 0, 6, 3, 6, 1, 5, 2, 5, 2, 8, 1, 5, 1, 5, 1, 8, 0, 6, 2, 5, 1, 9, 0, 8, 1, 5, 3, 12, 1, 8, 1, 7, 2, 11, 1, 8, 2, 8, 2, 10, 1, 6, 0, 9, 1, 12, 1, 7, 1, 5, 1, 13, 0, 9, 3, 6, 1, 15
Offset: 1
Examples
a(3) = 2 because 2^(2+3) = 32 mod (2+3) is equal to 2 and 3^(3+3) = 729 mod (3+3) is equal to 3; a(4) = 1 because 2^(2+4) = 64 mod (2+4) is equal to 4, but not is equal to 2, and 3^(3+4) = 2187 mod (3+4) is equal to 3.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Magma
[#[p: p in PrimesUpTo(n) | p^(p+n) mod (p+n) eq p]: n in [1..90]];
-
Maple
P:= NULL: R:= NULL: for n from 1 to 100 do if isprime(n) then P:= P,n fi; R:= R, nops(select(p -> p &^ (p+n) mod (p+n) = p, [P])); od: R; # Robert Israel, Mar 12 2025
-
Mathematica
a[n_] := Count[Range[n], ?(PrimeQ[#] && PowerMod[#, # + n, # + n] == # &)]; Array[a, 100] (* _Amiram Eldar, Feb 06 2025 *)
-
PARI
a(n) = my(nb=0); forprime(p=2, n, if (Mod(p, p+n)^(p+n) == p, nb++)); nb; \\ Michel Marcus, Feb 06 2025