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.

A356840 Largest most common prime factor of n.

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