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”).
%I #27 Nov 03 2024 18:54:52
%S 0,1,3,11,58,57,262,261,564,666,665,4775,7843,7842,9807,9804,15705,
%T 15704,15701,15699,15698,77964,77962,180330,180326,185136,185135,
%U 185133,185132,185130,678603,678601,1005372,1005371,1005366,2326178,8525865,8525862,8525860
%N a(n) is the minimal k such that nextprime(2k+1) - 2k = prime(n) where nextprime(n) is least prime > n.
%C 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?
%C If a(n+1) = a(n) - 1 and 2*a(n) + 1 is not prime, then (prime(n), prime(n+1)) is twin pair.
%C 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),...
%C From _Chai Wah Wu_, Feb 27 2018: (Start)
%C a(n) exists for all n since the prime gap can be arbitrarily large.
%C If k > 0 is a term, then p <= 2k+1 < nextprime(p) for some prime p in A002386.
%C 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.
%C 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.
%C (End)
%H Chai Wah Wu, <a href="/A229512/b229512.txt">Table of n, a(n) for n = 1..240</a>
%t Table[Block[{k = 0}, While[NextPrime[2 k + 1] - 2 k != p, k++]; k], {p, Prime@ Range@ 30}] (* _Michael De Vlieger_, Feb 28 2018 *)
%o (PARI) a(n) = my(k = 0, p = prime(n)); while (nextprime(2*k+2) - 2*k != p, k++); k \\ _Michel Marcus_, Sep 25 2013
%Y Cf. A000040, A002386, A151800.
%K nonn
%O 1,3
%A _Vladimir Shevelev_, Sep 25 2013
%E More terms from _Peter J. C. Moses_