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.

Showing 1-3 of 3 results.

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
    

A371884 Irregular triangle read by rows in which row n >= 2 lists the divisors d of n such that d^n mod n = d.

Original entry on oeis.org

1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, 1, 1, 4, 1, 1, 7, 1, 5, 1, 1, 1, 9, 1, 1, 5, 1, 7, 1, 11, 1, 1, 1, 1, 13, 1, 1, 4, 1, 1, 6, 10, 15, 1, 1, 1, 11, 1, 17, 1, 1, 9, 1, 1, 19, 1, 13, 1, 1, 1, 7, 21, 1, 1, 1, 9, 1, 23, 1, 1, 16, 1, 1, 25, 1, 17, 1, 13, 1, 1, 27, 1, 11, 1, 8, 1, 19, 1, 29, 1, 1, 1, 1, 31, 1, 1, 1, 5, 13
Offset: 2

Views

Author

Juri-Stepan Gerasimov, Apr 10 2024

Keywords

Examples

			Triangle begins:
    1;
    1;
    1;
    1;
    1, 3;
    1;
    1;
    1;
    1, 5;
    1;
    1, 4;
    1;
    1, 7;
    1, 5;
    1;
    1;
    1, 9;
    1;
    1, 5;
    1, 7;
    1, 11;
    1;
    1;
    1;
    1, 13;
    1;
    1, 4;
    1;
    1, 6, 10, 15;
    ...
		

Crossrefs

Programs

  • Magma
    [[d: d in Divisors(n) | d^n mod n eq d]: n in [2..65]];
  • Maple
    f:= proc(n) op(sort(convert(select(d -> d^n mod n = d, numtheory:-divisors(n)),list))) end proc:
    for n from 2 to 100 do f(n) od; # Robert Israel, May 11 2025
  • Mathematica
    row[n_] := Select[Divisors[n], PowerMod[#, n, n] == # &]; Array[row, 64, 2] // Flatten (* Amiram Eldar, Apr 11 2024 *)

A380393 a(n) is the least k that has exactly n proper divisors d such that (-d)^k == -d (mod k).

Original entry on oeis.org

1, 2, 6, 42, 66, 105, 2805, 561, 1365, 5005, 5565, 11305, 36465, 140505, 239785, 41041, 682465, 873145, 185185, 418285, 1683969, 2113665, 5503785, 1242241, 6697405, 8549905, 31932901, 11996985, 31260405, 30534805, 47031061, 825265, 27265161, 32306365, 55336645, 21662641, 9276085, 8964865
Offset: 0

Views

Author

Robert Israel, Jan 23 2025

Keywords

Comments

a(n) is the least k such that A378387(k) = n.
It appears that a(n) = A371513(n) except for n = 4 and n = 6. They are certainly equal when a(n) and A371513(n) are odd, since if k is odd, (-d)^k = -d^k == -d (mod k) if and only if d^k == d (mod k).

Examples

			a(4) = 42 because 42 has 3 such divisors: (-6)^42 == 36 == -6 (mod 42), (-14)^42 == 28 == -14 (mod 42), (-21)^42 == 21 == -21 (mod 42), and no smaller number works.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) nops(select((t -> (-t)&^n + t mod n = 0), numtheory:-divisors(n) minus {n})) end proc:
    N:= 30: # for a(0) .. a(N)
    V:= Array(0..N): count:= 0:
    for i from 1 while count < N+1 do
      v:= f(i);
      if v <= N and V[v] = 0 then V[v]:= i; count:= count+1 fi;
    od:
    convert(V,list);
  • PARI
    a(n) = my(k=1); while (sumdiv(k, d, if (dMichel Marcus, Jan 24 2025

Formula

A378387(a(n)) = n.
Showing 1-3 of 3 results.