login
Least prime p such that p+2n is also prime.
29

%I #66 Sep 23 2020 04:20:39

%S 2,3,3,5,3,3,5,3,3,5,3,7,5,3,3,7,5,3,5,3,3,5,3,7,5,3,7,5,3,3,7,5,3,5,

%T 3,3,7,5,3,5,3,7,5,3,13,7,5,3,5,3,3,5,3,3,5,3,19,13,11,13,7,5,3,5,3,7,

%U 5,3,3,11,11,7,5,3,3,7,5,3,7,5,3,5,3,7,5,3,7,5,3,3,11,11,7,5,3,3,5,3,3,13,11,31,7

%N Least prime p such that p+2n is also prime.

%C It is conjectured that a(n) always exists. a(n) has been computed for n < 5 * 10^11, with largest value a(248281210271) = 3307. - _Jens Kruse Andersen_, Nov 28 2004

%C If a(n) = a(n+1) = k, then 2*n + k and 2*(n+1) + k are twin primes. - _Ya-Ping Lu_, Sep 22 2020

%H T. D. Noe, <a href="/A020483/b020483.txt">Table of n, a(n) for n = 0..10000</a>

%H Jens Kruse Andersen, <a href="http://groups.yahoo.com/group/primenumbers/message/15641">Prime gaps (not necessarily consecutive)</a>, Yahoo! group "primenumbers", Nov 26 2004.

%H Jens Kruse Andersen, Mike Oakes, Ed Pegg Jr, <a href="/A020483/a020483.txt">Prime gaps (not necessarily consecutive)</a>, digest of 5 messages in primenumbers Yahoo group, Nov 26 - Nov 27, 2004.

%F If a(n) exists, a(n) < 2n, which of course is a great overestimate. - _T. D. Noe_, Jul 16 2002

%F a(n) = A087711(n) - n. - _Zak Seidov_, Nov 28 2007

%F a(n) = A020484(n) - 2n. - _Zak Seidov_, May 29 2014

%F a(n) = 2 if and only if n = 0. - _Alonso del Arte_, Mar 14 2018

%e Given n = 2, we see that 2 + 2n = 6 = 2 * 3, but 3 + 2n = 7, which is prime, so a(2) = 3.

%e Given n = 3, we see that 2 + 2n = 8 = 2^3 and 3 + 2n = 9 = 3^2, but 5 + 2n = 11, which is prime, so a(3) = 5.

%p A020483 := proc(n)

%p local p;

%p p := 2;

%p while true do

%p if isprime(p+2*n) then

%p return p;

%p end if;

%p p := nextprime(p) ;

%p end do:

%p end proc:

%p seq(A020483(n),n=0..40); # _R. J. Mathar_, Sep 23 2016

%t Table[j = 1; found = False; While[!found, j++; found = PrimeQ[Prime[j] + 2i]]; Prime[j], {i, 200}]

%t leastPrimep2n[n_] := Block[{k = 1, p, q = 2 n}, While[p = Prime@k; !PrimeQ[p + q], k++]; p]; Array[leastPrimep2n, 102] (* _Robert G. Wilson v_, Mar 26 2008 *)

%o (PARI) a(n)=forprime(p=2,,if(isprime(p+2*n), return(p))) \\ _Charles R Greathouse IV_, Mar 19 2014

%o (Haskell)

%o a020483 n = head [p | p <- a000040_list, a010051' (p + 2 * n) == 1]

%o -- _Reinhard Zumkeller_, Nov 29 2014

%o (GAP) P:=Filtered([1..10000],IsPrime);;

%o a:=List(List([0..110],n->Filtered(P,i->IsPrime(i+2*n))),Minimum); # _Muniru A Asiru_, Mar 26 2018

%Y Cf. A087711, A101042, A101043, A101044, A101045, A101046.

%Y Cf. A101045, A239392 (record values).

%Y Cf. A000040, A010051, A020484, A237055.

%Y It is likely that A054906 is an identical sequence, although this seems to have not yet been proved. - _N. J. A. Sloane_, Feb 06 2017

%K nonn

%O 0,1

%A _David W. Wilson_

%E a(0)=2 added by _N. J. A. Sloane_, Apr 25 2015