cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A356838 The smallest of the most common prime factors of n.

This page as a plain text file.
%I A356838 #47 Sep 13 2022 04:06:42
%S A356838 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 A356838 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 A356838 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 A356838 The smallest of the most common prime factors of n.
%C A356838 Pick the prime factors of n with the largest exponent. a(n) is the smallest one of those prime factors.
%C A356838 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 A356838 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 A356838 Jens Ahlström, <a href="/A356838/b356838.txt">Table of n, a(n) for n = 2..9999</a>
%e A356838 a(18) = 3, since 18 = 2 * 3^2 and 3 is the most common prime factor.
%e A356838 a(450) = 3, since 450 = 2 * 3^2 * 5^2 and 3 is the smallest of the most common prime factors.
%t A356838 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 A356838 (Python)
%o A356838 from sympy import factorint
%o A356838 from collections import Counter
%o A356838 def a(n):
%o A356838     return Counter(factorint(n)).most_common(1)[0][0]
%o A356838 (Python)
%o A356838 from sympy import factorint
%o A356838 def A356838(n): return max(factorint(n).items(),key=lambda x:(x[1],-x[0]))[0] # _Chai Wah Wu_, Sep 10 2022
%o A356838 (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 A356838 Cf. A051903, A356840, A020639, A356862.
%K A356838 nonn,easy
%O A356838 2,1
%A A356838 _Jens Ahlström_, Aug 31 2022