%I #38 Sep 13 2022 04:06:34
%S 2,3,2,5,3,7,2,3,5,11,2,13,7,5,2,17,3,19,2,7,11,23,2,5,13,3,2,29,5,31,
%T 2,11,17,7,3,37,19,13,2,41,7,43,2,3,23,47,2,7,5,17,2,53,3,11,2,19,29,
%U 59,2,61,31,3,2,13,11,67,2,23,7,71,2,73,37,5,2,11,13,79,2,3,41,83
%N Largest most common prime factor of n.
%C Pick the prime factors of n with the largest exponent. a(n) is the largest one of those prime factors. If the prime factorization of n has a unique largest exponent, then a(n) = A356838(n). Otherwise, a(n) is the largest of those most common prime factors, while A356838(n) is the smallest of them.
%H Jens Ahlström, <a href="/A356840/b356840.txt">Table of n, a(n) for n = 2..9999</a>
%e a(180) = 3, since 180 = 2^2 * 3^2 * 5 and the largest of the most common prime factor is 3.
%t 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 *)
%o (Python)
%o from sympy import factorint
%o from collections import Counter
%o def reversed_factors(n):
%o return dict(reversed(list(factorint(n).items())))
%o def a(n):
%o return Counter(reversed_factors(n)).most_common(1)[0][0]
%o (Python)
%o from sympy import factorint
%o def A356840(n): return max(factorint(n).items(),key=lambda x:(x[1],x[0]))[0] # _Chai Wah Wu_, Sep 10 2022
%o (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
%Y Cf. A051903, A356838, A356862.
%K nonn,easy
%O 2,1
%A _Jens Ahlström_, Aug 31 2022