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.

A347291 Multiplicative function defined by a(p) = 2 and a(p^k) = p^(k-1) for k >= 2.

Original entry on oeis.org

1, 2, 2, 2, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 4, 8, 2, 6, 2, 4, 4, 4, 2, 8, 5, 4, 9, 4, 2, 8, 2, 16, 4, 4, 4, 6, 2, 4, 4, 8, 2, 8, 2, 4, 6, 4, 2, 16, 7, 10, 4, 4, 2, 18, 4, 8, 4, 4, 2, 8, 2, 4, 6, 32, 4, 8, 2, 4, 4, 8, 2, 12, 2, 4, 10, 4, 4, 8, 2, 16, 27, 4, 2, 8, 4
Offset: 1

Views

Author

Shreevatsa R, Jan 22 2022

Keywords

Comments

a(n) is the least number of distinct values mod n attained by a polynomial p(x) such that p(x) == 0 (mod n) if and only if x == 0 (mod n).

Examples

			For n = 8, a(8) = a(2^3) = 2^2 = 4. Also, any polynomial p(x) that is 0 only for x == 0 (mod 8) takes at least a(8)=4 distinct values. (The polynomial p(x) = x^3 + x is an example.)
When n is a prime number, the polynomial p(x) = x^(n-1), by Fermat's little theorem, is 0 (mod n) when x == 0 (mod n), and 1 (mod n) otherwise. So it takes only two distinct values, and a(p) = 2.
a(360) = a(2^3 * 3^2 * 5) = 2^2 * 3 * 2 = 24.
		

Programs

  • Mathematica
    f[p_, e_] := If[e == 1, 2, p^(e - 1)]; a[n_] := Times @@ f @@@ FactorInteger[n]; a[1] = 1; Array[a, 100] (* Amiram Eldar, Jan 23 2022 *)
  • PARI
    a(n) = { my(f = factor(n)); for(i = 1, #f~, if(f[i, 2] == 1, f[i, 1] = 2; , f[i, 2]--; ) ); factorback(f) } \\ David A. Corneth, Jan 22 2022
  • Python
    from sympy import factorint, prod
    def a(n):
        return prod((2 if k == 1 else p**(k-1)) for (p, k) in factorint(n).items())
    

Formula

If n = p1^k1 p2^k2 ... pr^kr, then a(n) = a(p1^k1) a(p2^k2) ... a(pr^kr), where a(p^k) is 2 if k=1 and p^(k-1) if k>=2.
Dirichlet g.f.: zeta(s-1) * Product_{p prime} (1 - 1/p^(s-1) + 2/p^s - 1/p^(2*s-1)). - Amiram Eldar, Oct 01 2023

Extensions

Corrected and extended by David A. Corneth, Jan 22 2022