cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A038664 #65 Feb 16 2025 08:32:38
%S A038664 2,4,9,24,34,46,30,282,99,154,189,263,367,429,590,738,217,1183,3302,
%T A038664 2191,1879,1831,7970,3077,3427,2225,3793,8028,4612,4522,3644,8688,
%U A038664 14862,12542,15783,3385,34202,19026,17006,44773,23283,38590,14357
%N 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.
%C A038664 Does anyone know of a proof that a(n) is defined for all natural numbers n, i.e., f:n -> prime(n+1)-prime(n) is a surjective map from N-{1} -> E, where N, E are the sets of natural numbers and even numbers, respectively? - _Joseph L. Pe_, Dec 14 2002
%C A038664 a(n) is defined for all n if (but not only if) de Polignac's conjecture is true. - _Harry J. Smith_, Jul 22 2003
%H A038664 Reinhard Zumkeller, <a href="/A038664/b038664.txt">Table of n, a(n) for n = 1..111</a>
%H A038664 James Maynard, <a href="https://arxiv.org/abs/1311.4600">Small gaps between primes</a>, arXiv:1311.4600 [math.NT], 2013-2019.
%H A038664 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/dePolignacsConjecture.html">de Polignac's Conjecture</a>.
%F A038664 a(n) = A000720(A000230(n)). - _M. F. Hasler_, Jan 16 2011
%F A038664 A001223(a(n)) = 2*n and A001223(m) != 2*n for m < a(n). - _Reinhard Zumkeller_, Aug 23 2015
%t A038664 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 *)
%t A038664 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 *)
%o A038664 (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
%o A038664 (Haskell)
%o A038664 import Data.List (elemIndex); import Data.Maybe (fromJust)
%o A038664 a038664 = (+ 1) . fromJust . (`elemIndex` a001223_list) . (* 2)
%o A038664 -- _Reinhard Zumkeller_, Aug 23 2015
%Y A038664 Cf. A000230, A000720, A001223, A261525.
%K A038664 nonn
%O A038664 1,1
%A A038664 _Jeff Burch_
%E A038664 More terms from _Michel ten Voorde_, Apr 13 2001
%E A038664 "a(n) = -1 if ..." added to definition at the suggestion of Alexander Wajnberg by _N. J. A. Sloane_, Feb 02 2020