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.

A371883 a(n) is the number of divisors d of n such that d^n mod n = d.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 1, 4, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 3, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 3, 4, 1, 2, 2, 2, 1, 2, 1, 2, 2, 1, 1, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 1, 1, 3, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Apr 10 2024

Keywords

Comments

1 <= a(n) < A000005(n) for n >= 2.

Examples

			a(1) = 0: 1 divides 1, but 1^1 mod 1 = 0 (not 1).
a(2) = 1: 1 divides 2, and 1^2 mod 2 = 1;
          2 divides 2, but 2^2 mod 2 = 0 (not 2).
a(6) = 2: 1 divides 6, and 1^6 mod 6 = 1;
          2 divides 6, but 2^6 mod 6 = 4 (not 2);
          3 divides 6, and 3^6 mod 6 = 3;
          6 divides 6, but 6^6 mod 6 = 0 (not 6).
		

Crossrefs

Programs

  • Magma
    [#[d: d in Divisors(n) | d^n mod n eq d]: n in [1..100]];
    
  • Mathematica
    a[n_] := DivisorSum[n, 1 &, PowerMod[#, n, n] == # &]; Array[a, 100] (* Amiram Eldar, Apr 11 2024 *)
  • PARI
    a(n) = sumdiv(n, d, d^n % n == d); \\ Michel Marcus, Apr 20 2024
  • Python
    from sympy import divisors
    def a(n): return sum(1 for d in divisors(n)[:-1] if pow(d, n, n) == d)
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Apr 10 2024