A020483 Least prime p such that p+2n is also prime.
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, 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, 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
Offset: 0
Keywords
Examples
Given n = 2, we see that 2 + 2n = 6 = 2 * 3, but 3 + 2n = 7, which is prime, so a(2) = 3. 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.
Links
- T. D. Noe, Table of n, a(n) for n = 0..10000
- Jens Kruse Andersen, Prime gaps (not necessarily consecutive), Yahoo! group "primenumbers", Nov 26 2004.
- Jens Kruse Andersen, Mike Oakes, Ed Pegg Jr, Prime gaps (not necessarily consecutive), digest of 5 messages in primenumbers Yahoo group, Nov 26 - Nov 27, 2004.
Crossrefs
Programs
-
GAP
P:=Filtered([1..10000],IsPrime);; a:=List(List([0..110],n->Filtered(P,i->IsPrime(i+2*n))),Minimum); # Muniru A Asiru, Mar 26 2018
-
Haskell
a020483 n = head [p | p <- a000040_list, a010051' (p + 2 * n) == 1] -- Reinhard Zumkeller, Nov 29 2014
-
Maple
A020483 := proc(n) local p; p := 2; while true do if isprime(p+2*n) then return p; end if; p := nextprime(p) ; end do: end proc: seq(A020483(n),n=0..40); # R. J. Mathar, Sep 23 2016
-
Mathematica
Table[j = 1; found = False; While[!found, j++; found = PrimeQ[Prime[j] + 2i]]; Prime[j], {i, 200}] 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 *)
-
PARI
a(n)=forprime(p=2,,if(isprime(p+2*n), return(p))) \\ Charles R Greathouse IV, Mar 19 2014
Formula
If a(n) exists, a(n) < 2n, which of course is a great overestimate. - T. D. Noe, Jul 16 2002
a(n) = A087711(n) - n. - Zak Seidov, Nov 28 2007
a(n) = A020484(n) - 2n. - Zak Seidov, May 29 2014
a(n) = 2 if and only if n = 0. - Alonso del Arte, Mar 14 2018
Extensions
a(0)=2 added by N. J. A. Sloane, Apr 25 2015
Comments