%I #47 Sep 13 2022 04:06:42
%S 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,
%T 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,
%U 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
%N The smallest of the most common prime factors of n.
%C Pick the prime factors of n with the largest exponent. a(n) is the smallest one of those prime factors.
%C 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.
%C 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.
%H Jens Ahlström, <a href="/A356838/b356838.txt">Table of n, a(n) for n = 2..9999</a>
%e a(18) = 3, since 18 = 2 * 3^2 and 3 is the most common prime factor.
%e a(450) = 3, since 450 = 2 * 3^2 * 5^2 and 3 is the smallest of the most common prime factors.
%t 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 *)
%o (Python)
%o from sympy import factorint
%o from collections import Counter
%o def a(n):
%o return Counter(factorint(n)).most_common(1)[0][0]
%o (Python)
%o from sympy import factorint
%o def A356838(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~])); vecmin(vector(#w, k, f[w[k], 1])); \\ _Michel Marcus_, Sep 01 2022
%Y Cf. A051903, A356840, A020639, A356862.
%K nonn,easy
%O 2,1
%A _Jens Ahlström_, Aug 31 2022