OFFSET
2,1
COMMENTS
Pick the prime factors of n with the largest exponent. a(n) is the smallest one of those prime factors.
LINKS
Jens Ahlström, Table of n, a(n) for n = 2..9999
EXAMPLE
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.
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 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jens Ahlström, Aug 31 2022
STATUS
approved