A356838 The smallest of the most common prime factors of n.
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
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.
Links
- Jens Ahlström, Table of n, a(n) for n = 2..9999
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
Comments