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.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Jul 31 2021

Keywords

Comments

Of course for any n, k being equal to either 1 or n-1 would work.

Crossrefs

Programs

  • 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]
  • PARI
    a(n) = sum(k=1, n-1, Mod(k, n)^(n-k) + Mod(n-k, n)^k == 0); \\ Michel Marcus, Aug 06 2021
  • 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