OFFSET
1,6
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
EXAMPLE
a(12) = 3: 1 divides 12, and 1^12 mod 12 = 1;
2 divides 12, and 2^12 mod 12 = 4;
3 divides 12, but 3^12 mod 12 = 9 (not a divisor of 12);
4 divides 12, and 4^12 mod 12 = 4;
6 divides 12, but 6^12 mod 12 = 0 (not a divisor of 12);
12 divides 12, but 12^12 mod 12 = 0 (not a divisor of 12).
MATHEMATICA
a[n_] := DivisorSum[n, 1 &, (m = PowerMod[#, n, n]) > 0 && Divisible[n, m] &]; Array[a, 100] (* Amiram Eldar, May 13 2024 *)
PROG
(Magma) [&+[#[d: d in Divisors(n) | d^n mod n eq k and n mod k eq 0]: k in [1..n]]: n in [1..100]];
(PARI) A372772(n) = { my(k); sumdiv(n, d, k=lift(Mod(d^n, n)); k > 0 && 0==(n%k)); }; \\ Antti Karttunen, May 13 2024
(Python)
from sympy import divisors
def a(n):
divs = set(divisors(n)[:-1])
return sum(1 for d in divs if pow(d, n, n) in divs)
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, May 13 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, May 12 2024
STATUS
approved