OFFSET
2,1
COMMENTS
LINKS
Jens Ahlström, Table of n, a(n) for n = 2..9999
EXAMPLE
a(180) = 3, since 180 = 2^2 * 3^2 * 5 and the largest of the most common prime factor is 3.
MATHEMATICA
a[n_] := Module[{f = FactorInteger[n], p, e}, p = f[[;; , 1]]; e = f[[;; , 2]]; p[[Position[e, Max[e]][[-1, 1]]]]]; Array[a, 100, 2] (* Amiram Eldar, Sep 01 2022 *)
PROG
(Python)
from sympy import factorint
from collections import Counter
def reversed_factors(n):
return dict(reversed(list(factorint(n).items())))
def a(n):
return Counter(reversed_factors(n)).most_common(1)[0][0]
(Python)
from sympy import factorint
def A356840(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~])); vecmax(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