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.

A052180 Last filtering prime for n-th prime p: find smallest prime factor of each of the composite numbers between p and next prime; take maximal value.

This page as a plain text file.
%I A052180 #40 Feb 03 2021 21:52:22
%S A052180 2,2,3,2,3,2,3,5,2,5,3,2,3,7,5,2,5,3,2,7,3,5,7,3,2,3,2,3,11,3,7,2,11,
%T A052180 2,5,7,3,13,5,2,11,2,3,2,11,13,3,2,3,5,2,13,11,7,5,2,5,3,2,17,13,3,2,
%U A052180 3,17,5,11,2,3,5,19,7,13,3,5,17,3,13,7,2,7,2,19,3,5,11,3,2,3,11,13,3,17
%N A052180 Last filtering prime for n-th prime p: find smallest prime factor of each of the composite numbers between p and next prime; take maximal value.
%C A052180 A000879(n) is the least index i such that a(i) = prime(n). - _Labos Elemer_, May 14 2003
%H A052180 T. D. Noe, <a href="/A052180/b052180.txt">Table of n, a(n) for n=2..10000</a>
%F A052180 a(n) = Max_{j=1+prime(n)..prime(n+1)-1} A020639(j) where A020639(j) is the least prime dividing j.
%e A052180 For n=9, n-th prime is 23, composites between 23 and next prime are 24 25 26 27 28, smallest prime divisors are 2 5 2 3 2; maximal value is 5, so a(9)=5.
%t A052180 ffi[x_] := Flatten[FactorInteger[x]];
%t A052180 lf[x_] := Length[FactorInteger[x]];
%t A052180 ba[x_] := Table[Part[ffi[x], 2*w-1], {w, 1, lf[x]}];
%t A052180 mi[x_] := Min[ba[x]];
%t A052180 Table[Max[Table[mi[ba[w]], {w, Prime[j]+1, -1+Prime[j+1]}]], {j, 2, 256}]
%t A052180 (* Second program: *)
%t A052180 mpf[{a_,b_}] := Max[FactorInteger[#][[1,1]]& /@ Range[a+1,b-1]];
%t A052180 mpf/@ Partition[ Prime[Range[2,100]],2,1] (* _Harvey P. Dale_, Apr 30 2013 *)
%o A052180 (Haskell)
%o A052180 a052180 n = a052180_list !! (n-2)
%o A052180 a052180_list = f [4..] where
%o A052180    f ws = (maximum $ map a020639 us) : f vs where
%o A052180      (us, _:vs) = span  ((== 0) . a010051) ws
%o A052180 -- _Reinhard Zumkeller_, Dec 27 2012
%o A052180 (PARI) a(n) = {my(p = prime(n), amax = 0); forcomposite(c = p, nextprime(p+1), amax = max(factor(c)[1,1], amax);); amax;} \\ _Michel Marcus_, Apr 21 2018
%o A052180 (Python)
%o A052180 from sympy import prime, nextprime, primefactors
%o A052180 def a(n):
%o A052180   p = prime(n); q = nextprime(p)
%o A052180   return max(min(primefactors(m)) for m in range(p+1, q))
%o A052180 print([a(n) for n in range(2, 95)]) # _Michael S. Branicky_, Feb 02 2021
%Y A052180 Cf. A052248, A020639, A000720, A083269, A000879.
%Y A052180 Cf. A010051.
%K A052180 nonn,easy,nice
%O A052180 2,1
%A A052180 _Labos Elemer_, Feb 05 2000