login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A229512
a(n) is the minimal k such that nextprime(2k+1) - 2k = prime(n) where nextprime(n) is least prime > n.
1
0, 1, 3, 11, 58, 57, 262, 261, 564, 666, 665, 4775, 7843, 7842, 9807, 9804, 15705, 15704, 15701, 15699, 15698, 77964, 77962, 180330, 180326, 185136, 185135, 185133, 185132, 185130, 678603, 678601, 1005372, 1005371, 1005366, 2326178, 8525865, 8525862, 8525860
OFFSET
1,3
COMMENTS
It is interesting to note the distribution of terms over groups of close magnitudes. For example, 58,57; 9807,9804;, 15704,15701,15699,15698; etc. Is there an explanation?
If a(n+1) = a(n) - 1 and 2*a(n) + 1 is not prime, then (prime(n), prime(n+1)) is twin pair.
We call a twin pair (prime(n), prime(n+1)) regular, if a(n+1) = a(n) - 1, and irregular otherwise. The first irregular pairs are (3,5),(5,7),(149,151),...
From Chai Wah Wu, Feb 27 2018: (Start)
a(n) exists for all n since the prime gap can be arbitrarily large.
If k > 0 is a term, then p <= 2k+1 < nextprime(p) for some prime p in A002386.
In this case, for k = (p-1)/2, nextprime(2*m+1) - 2*m = g - 2*(m-k) for k <= m < k + (g-1)/2 where g = nextprime(p) - p + 1.
For large g, this set of numbers m will include a few terms of the sequence (as g - 2*(m-k) will cover some primes not yet found) which result in the clusters of terms observed.
(End)
LINKS
MATHEMATICA
Table[Block[{k = 0}, While[NextPrime[2 k + 1] - 2 k != p, k++]; k], {p, Prime@ Range@ 30}] (* Michael De Vlieger, Feb 28 2018 *)
PROG
(PARI) a(n) = my(k = 0, p = prime(n)); while (nextprime(2*k+2) - 2*k != p, k++); k \\ Michel Marcus, Sep 25 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Sep 25 2013
EXTENSIONS
More terms from Peter J. C. Moses
STATUS
approved