OFFSET
2,1
COMMENTS
A000879(n) is the least index i such that a(i) = prime(n). - Labos Elemer, May 14 2003
LINKS
T. D. Noe, Table of n, a(n) for n=2..10000
FORMULA
EXAMPLE
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.
MATHEMATICA
ffi[x_] := Flatten[FactorInteger[x]];
lf[x_] := Length[FactorInteger[x]];
ba[x_] := Table[Part[ffi[x], 2*w-1], {w, 1, lf[x]}];
mi[x_] := Min[ba[x]];
Table[Max[Table[mi[ba[w]], {w, Prime[j]+1, -1+Prime[j+1]}]], {j, 2, 256}]
(* Second program: *)
mpf[{a_, b_}] := Max[FactorInteger[#][[1, 1]]& /@ Range[a+1, b-1]];
mpf/@ Partition[ Prime[Range[2, 100]], 2, 1] (* Harvey P. Dale, Apr 30 2013 *)
PROG
(Haskell)
a052180 n = a052180_list !! (n-2)
a052180_list = f [4..] where
f ws = (maximum $ map a020639 us) : f vs where
(us, _:vs) = span ((== 0) . a010051) ws
-- Reinhard Zumkeller, Dec 27 2012
(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
(Python)
from sympy import prime, nextprime, primefactors
def a(n):
p = prime(n); q = nextprime(p)
return max(min(primefactors(m)) for m in range(p+1, q))
print([a(n) for n in range(2, 95)]) # Michael S. Branicky, Feb 02 2021
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Labos Elemer, Feb 05 2000
STATUS
approved