OFFSET
1,1
COMMENTS
LINKS
V. Shevelev, On critical small intervals containing primes, arXiv:0908.2319 [math.NT], 2009.
EXAMPLE
The first four values are 2 because prime(1)=2, prime(2)=3, prime(3)=5 and prime(4)=7 are all in the prime chain starting at 2.
MAPLE
A060308 := proc(n) prevprime(2*n+1) ; end:
isA164368 := proc(p) local q ; q := nextprime(floor(p/2)) ; return (numtheory[pi](2*q) -numtheory[pi](p) >= 1); end proc:
A164368 := proc(n) option remember; local a; if n = 1 then 2; else a := nextprime( procname(n-1)) ; while not isA164368(a) do a := nextprime(a) ; end do : RETURN(a) ; end if; end proc:
A164918 := proc(n) local p, a, j, q, itr ; p := ithprime(n) ; a := 1000000000000000 ; for j from 1 do q := A164368(j) ; if q > p then break; end if; itr := 0 ; while q < p do q := A060308(q) ; itr := itr+1 ; end do; if q = p then return A164368(j) ; end if; end do: end proc:
seq(A164918(n), n=1..120) ; # R. J. Mathar, Mar 12 2010
MATHEMATICA
lp[n_] := NextPrime[2n, -1];
a[n_] := For[pn = Prime[n]; p = 2, p <= pn, p = NextPrime[p], nwl = NestWhileList[lp, p, # <= Prime[n]&]; If[MemberQ[nwl, pn], Return[p]]];
Array[a, 120] (* Jean-François Alcover, Dec 01 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Aug 31 2009
EXTENSIONS
Edited and extended by R. J. Mathar, Mar 12 2010
STATUS
approved