login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A371883
a(n) is the number of divisors d of n such that d^n mod n = d.
4
0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 1, 4, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 3, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 3, 4, 1, 2, 2, 2, 1, 2, 1, 2, 2, 1, 1, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 1, 1, 3, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2
OFFSET
1,6
COMMENTS
1 <= a(n) < A000005(n) for n >= 2.
LINKS
EXAMPLE
a(1) = 0: 1 divides 1, but 1^1 mod 1 = 0 (not 1).
a(2) = 1: 1 divides 2, and 1^2 mod 2 = 1;
2 divides 2, but 2^2 mod 2 = 0 (not 2).
a(6) = 2: 1 divides 6, and 1^6 mod 6 = 1;
2 divides 6, but 2^6 mod 6 = 4 (not 2);
3 divides 6, and 3^6 mod 6 = 3;
6 divides 6, but 6^6 mod 6 = 0 (not 6).
MATHEMATICA
a[n_] := DivisorSum[n, 1 &, PowerMod[#, n, n] == # &]; Array[a, 100] (* Amiram Eldar, Apr 11 2024 *)
PROG
(Magma) [#[d: d in Divisors(n) | d^n mod n eq d]: n in [1..100]];
(Python)
from sympy import divisors
def a(n): return sum(1 for d in divisors(n)[:-1] if pow(d, n, n) == d)
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Apr 10 2024
(PARI) a(n) = sumdiv(n, d, d^n % n == d); \\ Michel Marcus, Apr 20 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved