A038664 a(n)-th and (a(n)+1)-st primes are the first pair of primes that differ by exactly 2n; a(n) = -1 if no such pair of primes exists.
2, 4, 9, 24, 34, 46, 30, 282, 99, 154, 189, 263, 367, 429, 590, 738, 217, 1183, 3302, 2191, 1879, 1831, 7970, 3077, 3427, 2225, 3793, 8028, 4612, 4522, 3644, 8688, 14862, 12542, 15783, 3385, 34202, 19026, 17006, 44773, 23283, 38590, 14357
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..111
- James Maynard, Small gaps between primes, arXiv:1311.4600 [math.NT], 2013-2019.
- Eric Weisstein's World of Mathematics, de Polignac's Conjecture.
Programs
-
Haskell
import Data.List (elemIndex); import Data.Maybe (fromJust) a038664 = (+ 1) . fromJust . (`elemIndex` a001223_list) . (* 2) -- Reinhard Zumkeller, Aug 23 2015
-
Mathematica
Table[k = 0; While[k++; p1 = Prime[k]; p2 = Prime[k + 1]; (p2 - p1) != n]; k, {n, 2, 200, 2}] (* Lei Zhou, Mar 01 2005 *) With[{d=Differences[Prime[Range[50000]]]},Flatten[Table[Position[d,2n,1,1],{n,50}]]] (* This program is many times faster than the first Mathematica program above. *) (* Harvey P. Dale, Nov 24 2012 *)
-
PARI
first(m)=my(v=vector(m),n);for(n=1,m,v[n]=0;until(2*n==prime(v[n]+1)-prime(v[n]),v[n]++)); v; \\ Anders Hellström, Jul 19 2015
Formula
Extensions
More terms from Michel ten Voorde, Apr 13 2001
"a(n) = -1 if ..." added to definition at the suggestion of Alexander Wajnberg by N. J. A. Sloane, Feb 02 2020
Comments