cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A346744 The number of congruences k^(n-k) + (n-k)^k == 0 (mod n) with 0 < k < n.

This page as a plain text file.
%I A346744 #25 May 06 2025 15:37:31
%S A346744 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,
%T A346744 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,
%U A346744 4,5,14,33,6,13,6,17,2,25,2,31,2,9,12,11,6,29,4
%N A346744 The number of congruences k^(n-k) + (n-k)^k == 0 (mod n) with 0 < k < n.
%C A346744 Of course for any n, k being equal to either 1 or n-1 would work.
%H A346744 Seiichi Manyama, <a href="/A346744/b346744.txt">Table of n, a(n) for n = 1..10000</a>
%p A346744 a:= n-> add(`if`(k&^(n-k)+(n-k)&^k mod n=0, 1, 0), k=1..n-1):
%p A346744 seq(a(n), n=1..100);  # _Alois P. Heinz_, Aug 06 2021
%t A346744 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]
%o A346744 (Python)
%o A346744 def a(n): return sum((k**(n-k) + (n-k)**k)%n == 0 for k in range(1, n))
%o A346744 print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 31 2021
%o A346744 (PARI) a(n) = sum(k=1, n-1, Mod(k, n)^(n-k) + Mod(n-k, n)^k == 0); \\ _Michel Marcus_, Aug 06 2021
%Y A346744 Cf. A114977, A114978, A114979, A114980, A114981.
%K A346744 easy,nonn
%O A346744 1,3
%A A346744 _Robert G. Wilson v_, Jul 31 2021