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”).
%I #22 May 27 2024 23:10:41
%S 0,1,1,1,1,2,1,1,1,2,1,3,1,2,2,1,1,3,1,2,2,2,1,1,1,2,1,2,1,4,1,1,2,2,
%T 1,3,1,2,2,1,1,3,1,1,2,2,1,5,1,3,2,2,1,4,2,2,2,2,1,1,1,2,1,1,3,4,1,2,
%U 2,2,1,3,1,2,2,1,1,3,1,5,1,2,1,4,2,2,2,1,1,5,2,1,2,2,2,1,1,3,1,3
%N a(n) is the number of divisors d of n such that d^n mod n = k, where k is also a divisor of n.
%H Antti Karttunen, <a href="/A372772/b372772.txt">Table of n, a(n) for n = 1..16384</a>
%e a(12) = 3: 1 divides 12, and 1^12 mod 12 = 1;
%e 2 divides 12, and 2^12 mod 12 = 4;
%e 3 divides 12, but 3^12 mod 12 = 9 (not a divisor of 12);
%e 4 divides 12, and 4^12 mod 12 = 4;
%e 6 divides 12, but 6^12 mod 12 = 0 (not a divisor of 12);
%e 12 divides 12, but 12^12 mod 12 = 0 (not a divisor of 12).
%t a[n_] := DivisorSum[n, 1 &, (m = PowerMod[#, n, n]) > 0 && Divisible[n, m] &]; Array[a, 100] (* _Amiram Eldar_, May 13 2024 *)
%o (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]];
%o (PARI) A372772(n) = { my(k); sumdiv(n, d, k=lift(Mod(d^n,n)); k > 0 && 0==(n%k)); }; \\ _Antti Karttunen_, May 13 2024
%o (Python)
%o from sympy import divisors
%o def a(n):
%o divs = set(divisors(n)[:-1])
%o return sum(1 for d in divs if pow(d, n, n) in divs)
%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, May 13 2024
%Y Cf. A371883.
%K nonn
%O 1,6
%A _Juri-Stepan Gerasimov_, May 12 2024