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.

Showing 1-2 of 2 results.

A014320 The next new gap between successive primes.

Original entry on oeis.org

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
Offset: 1

Views

Author

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

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • Haskell
    import Data.List (nub)
    a014320 n = a014320_list !! (n-1)
    a014320_list = nub $ a001223_list
    -- Reinhard Zumkeller, Apr 03 2015
    
  • 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 *)
  • 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

Formula

a(n) = A335367(n) - A335366(n). - Alexei Kourbatov, Jun 04 2020
a(n) = 2*A014321(n-1) for n >= 2. - Robert Israel, May 27 2024

Extensions

More terms from Sascha Kurz, Mar 24 2002

A335367 Primes at the end of the first-occurrence gaps in A014320.

Original entry on oeis.org

3, 5, 11, 29, 97, 127, 149, 211, 541, 907, 1151, 1361, 1693, 1847, 2503, 2999, 4327, 5623, 9587, 15727, 16183, 19373, 19661, 28277, 30631, 31469, 31957, 34123, 35671, 43391, 44351, 81509, 82129, 89753, 134581, 156007, 162209, 173429, 188107, 212777, 265703
Offset: 1

Views

Author

Alexei Kourbatov, Jun 03 2020

Keywords

Comments

Contains A000101 as a subsequence. First differs from A000101 at a(7)=149. See A000101, A002386 and A005250 for more references and links.

Examples

			The first two primes are 2 and 3, and the first prime gap is 3 - 2 = 1; so a(1)=3. The next prime is 5, and the next gap is 5 - 3 = 2; this gap size has not occurred before, so a(2)=5. 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.
		

Crossrefs

Programs

  • PARI
    my(isFirstOcc=vector(9999, j, 1), s=2); forprime(p=3, 1e8, my(g=p-s); if(isFirstOcc[g], print1(p, ", "); isFirstOcc[g]=0); s=p)

Formula

a(n) = A335366(n) + A014320(n).
Showing 1-2 of 2 results.