OFFSET
1,5
COMMENTS
For n<=20000, the largest a(n) is a(49)=23. a(n)=0 for n = 1, 2, 3, 4, 6, 43, 37890, 606457, ... corresponding to the twin primes (p, p+2) with p=3, 5, 11, 17, 41, 1277, 5995727, 143556431, ....
LINKS
Peter J. C. Moses, Table of n, a(n) for n = 1..20000
Vladimir Shevelev, Charles R. Greathouse IV, Peter J. C. Moses, On intervals (kn, (k+1)n) containing a prime for all n>1, Journal of Integer Sequences, Vol. 16 (2013), Article 13.7.3. arXiv:1212.2785
J. Sondow, J. W. Nicholson, and T. D. Noe, Ramanujan Primes: Bounds, Runs, Twins, and Gaps, J. Integer Seq. 14 (2011) Article 11.6.2
EXAMPLE
The 13th twin prime pair is {179, 181}. For r = 2 the range {358, ..., 362} contains prime 359; for r = 3, the range {537, ..., 543} contains prime 541; for r = 4, the range {716, ..., 724} contains prime 719. But for r = 5, the range {895, ..., 905} does not contain any prime. Thus a(13) = 5.
MATHEMATICA
rmax = 100; p1[1] = 3; p1[n_] := p1[n] = (p = NextPrime[p1[n-1]]; While[ !PrimeQ[p+2], p = NextPrime[p]]; p); a[n_] := Catch[ For[r = 2, r <= rmax, r++, If[ PrimePi[r*p1[n]] == PrimePi[r*(p1[n] + 2)], Throw[r], If[r == rmax, Throw[0]]]]]; Table[ a[n] , {n, 1, 65}] (* Jean-François Alcover, Dec 13 2012 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Typo in definition corrected by Jonathan Sondow, Dec 21 2012
STATUS
approved