login
A346744
The number of congruencies k^(n-k) + (n-k)^k == 0 (mod n) with 0 < k < n.
1
0, 1, 2, 3, 2, 3, 2, 5, 4, 7, 4, 7, 2, 3, 2, 9, 2, 7, 6, 7, 8, 3, 2, 15, 6, 9, 10, 11, 4, 17, 4, 17, 4, 9, 8, 15, 2, 5, 10, 15, 2, 13, 4, 11, 6, 3, 2, 19, 8, 15, 2, 11, 2, 19, 12, 19, 8, 11, 4, 19, 4, 5, 14, 33, 6, 13, 6, 17, 2, 25, 2, 31, 2, 9, 12, 11, 6, 29, 4
OFFSET
1,3
COMMENTS
Of course for any n, k being equal to either 1 or n-1 would work.
LINKS
MAPLE
a:= n-> add(`if`(k&^(n-k)+(n-k)&^k mod n=0, 1, 0), k=1..n-1):
seq(a(n), n=1..100); # Alois P. Heinz, Aug 06 2021
MATHEMATICA
f[n_] := Block[{c = 0, k = 1}, While[k < n, If[ Mod[ PowerMod[k, n - k, n] + PowerMod[n - k, k, n], n] == 0, c++]; k++]; c]; Array[f@# &, 100]
PROG
(Python)
def a(n): return sum((k**(n-k) + (n-k)**k)%n == 0 for k in range(1, n))
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Jul 31 2021
(PARI) a(n) = sum(k=1, n-1, Mod(k, n)^(n-k) + Mod(n-k, n)^k == 0); \\ Michel Marcus, Aug 06 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Jul 31 2021
STATUS
approved