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.

A356838 The smallest of the most common prime factors of n.

Original entry on oeis.org

2, 3, 2, 5, 2, 7, 2, 3, 2, 11, 2, 13, 2, 3, 2, 17, 3, 19, 2, 3, 2, 23, 2, 5, 2, 3, 2, 29, 2, 31, 2, 3, 2, 5, 2, 37, 2, 3, 2, 41, 2, 43, 2, 3, 2, 47, 2, 7, 5, 3, 2, 53, 3, 5, 2, 3, 2, 59, 2, 61, 2, 3, 2, 5, 2, 67, 2, 3, 2, 71, 2, 73, 2, 5, 2, 7, 2, 79, 2, 3, 2, 83, 2, 5, 2, 3, 2, 89
Offset: 2

Views

Author

Jens Ahlström, Aug 31 2022

Keywords

Comments

Pick the prime factors of n with the largest exponent. a(n) is the smallest one of those prime factors.
If the prime factorization of n has a unique largest exponent (A356862), then a(n) = A356840(n). Otherwise a(n) is the smallest of the most common prime factors, while A356840(n) is the largest of them.
a(n) differs from A020639(n) in case the smallest prime factor is not the most common. For example: a(90) = 3, since 90 = 2 * 3^2 * 5 and 3 has the largest exponent. This is different from A020639(90) = 2, since 2 is the smallest prime factor.

Examples

			a(18) = 3, since 18 = 2 * 3^2 and 3 is the most common prime factor.
a(450) = 3, since 450 = 2 * 3^2 * 5^2 and 3 is the smallest of the most common prime factors.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{f = FactorInteger[n], p, e}, p = f[[;; , 1]]; e = f[[;; , 2]]; p[[FirstPosition[e, Max[e]][[1]]]]]; Array[a, 100, 2] (* Amiram Eldar, Sep 01 2022 *)
  • PARI
    a(n) = my(f=factor(n), m=vecmax(f[,2]), w=select(x->(f[x,2] == m), [1..#f~])); vecmin(vector(#w, k, f[w[k], 1])); \\ Michel Marcus, Sep 01 2022
  • Python
    from sympy import factorint
    from collections import Counter
    def a(n):
        return Counter(factorint(n)).most_common(1)[0][0]
    
  • Python
    from sympy import factorint
    def A356838(n): return max(factorint(n).items(),key=lambda x:(x[1],-x[0]))[0] # Chai Wah Wu, Sep 10 2022