login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A014320 The next new gap between successive primes. 16
1, 2, 4, 6, 8, 14, 10, 12, 18, 20, 22, 34, 24, 16, 26, 28, 30, 32, 36, 44, 42, 40, 52, 48, 38, 72, 50, 62, 54, 60, 58, 46, 56, 64, 68, 86, 66, 70, 78, 76, 82, 96, 112, 100, 74, 90, 84, 114, 80, 88, 98, 92, 106, 94, 118, 132, 104, 102, 110, 126, 120, 148, 108, 122, 138 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Prime differences A001223 in natural order with duplicates removed. - Reinhard Zumkeller, Apr 03 2015

Conjecture: a(n) = O(n). See arXiv:2002.02115 for discussion. - Alexei Kourbatov, Jun 04 2020

LINKS

Alexei Kourbatov, Table of n, a(n) for n = 1..745 (terms 1..120 from Reinhard Zumkeller)

Alexei Kourbatov and Marek Wolf, On the first occurrences of gaps between primes in a residue class, arXiv preprint arXiv:2002.02115 [math.NT], 2020.

FORMULA

a(n) = A335367(n) - A335366(n). - Alexei Kourbatov, Jun 04 2020

EXAMPLE

The first two primes are 2 and 3, and the first prime gap is 3 - 2 = 1; so a(1) = 1. The next prime is 5, and the next gap is 5 - 3 = 2; this gap size has not occurred before, so a(2) = 2. The next prime is 7, and the next gap is 7 - 5 = 2; the gap size 2 has already occurred before, so nothing is added to the sequence.

MATHEMATICA

max = 300000; allGaps = Transpose[ {gaps = Differences[ Prime[ Range[max]]], Range[ Length[gaps]]}]; equalGaps = Split[ Sort[ allGaps, #1[[1]] < #2[[1]] & ], #1[[1]] == #2[[1]] & ]; firstGaps = ((Sort[#1, #1[[1]] < #2[[1]] & ] & ) /@ equalGaps)[[All, 1]]; Sort[ firstGaps, #1[[2]] < #2[[2]] & ][[All, 1]] (* Jean-Fran├žois Alcover, Oct 21 2011 *)

DeleteDuplicates[Differences[Prime[Range[10000]]]] (* Alonso del Arte, Jun 05 2020 *)

PROG

(Haskell)

import Data.List (nub)

a014320 n = a014320_list !! (n-1)

a014320_list = nub $ a001223_list

-- Reinhard Zumkeller, Apr 03 2015

(PARI) my(isFirstOcc=vector(9999, j, 1), s=2); forprime(p=3, 1e8, my(g=p-s); if(isFirstOcc[g], print1(g, ", "); isFirstOcc[g]=0); s=p) \\ Alexei Kourbatov, Jun 03 2020

(Scala) val prime: LazyList[Int] = 2 #:: LazyList.from(3).filter(i => prime.takeWhile {

   j => j * j <= i

}.forall {

   k => i % k != 0

})

val primes = prime.take(1000).toList

primes.zip(primes.tail).map(p => p._2 - p._1).distinct // Alonso del Arte, Jun 04 2020

CROSSREFS

Cf. A000101, A001223, A002386, A005250, A330853, A334543, A335366, A335367.

Sequence in context: A094092 A072791 A058320 * A080377 A086526 A086529

Adjacent sequences:  A014317 A014318 A014319 * A014321 A014322 A014323

KEYWORD

nonn

AUTHOR

Hynek Mlcousek (hynek(AT)dior.ics.muni.cz)

EXTENSIONS

More terms from Sascha Kurz, Mar 24 2002

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 19:09 EDT 2021. Contains 343573 sequences. (Running on oeis4.)