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-10 of 981 results. Next

A333254 Lengths of maximal runs in the sequence of prime gaps (A001223).

Original entry on oeis.org

1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Gus Wiseman, Mar 20 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.
Also lengths of maximal arithmetic progressions of consecutive primes.

Examples

			The prime gaps split into the following runs: (1), (2,2), (4), (2), (4), (2), (4), (6), (2), (6), (4), (2), (4), (6,6), (2), (6), (4), ...
		

Crossrefs

The version for A000002 is A000002. Similarly for A001462.
The unequal version is A333216.
The weakly decreasing version is A333212.
The weakly increasing version is A333215.
The strictly decreasing version is A333252.
The strictly increasing version is A333253.
Positions of first appearances are A335406.
The first term of the first length-n arithmetic progression of consecutive primes is A006560(n), with index A089180(n).
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Positions of adjacent unequal prime gaps are A333214.

Programs

  • Maple
    p:= 3: t:= 1: R:= NULL: s:= 1: count:= 0:
    for i from 2 while count < 100 do
      q:= nextprime(p);
      g:= q-p; p:= q;
      if g = t then s:= s+1
      else count:= count+1; R:= R, s; t:= g; s:= 1;
      fi
    od:
    R; # Robert Israel, Jan 06 2021
  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],#1==#2&]//Most

Formula

Partial sums are A333214.

A027833 Distances between successive 2's in sequence A001223 of differences between consecutive primes.

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 3, 6, 2, 5, 2, 6, 2, 2, 4, 3, 5, 3, 4, 5, 12, 2, 6, 9, 6, 5, 4, 3, 4, 20, 2, 2, 4, 4, 19, 2, 3, 2, 4, 8, 11, 5, 3, 3, 3, 10, 5, 4, 2, 17, 3, 6, 3, 3, 9, 9, 2, 6, 2, 6, 5, 6, 2, 3, 2, 3, 9, 4, 7, 3, 7, 20, 4, 7, 6, 5, 3, 7, 3, 20, 2, 14, 4, 10, 2, 3, 6, 4, 2, 2, 7, 2, 6, 3
Offset: 1

Views

Author

Jean-Marc MALASOMA (Malasoma(AT)entpe.fr)

Keywords

Comments

a(n) = number of primes p such that A014574(n) < p < A014574(n+1). - Thomas Ordowski, Jul 20 2012
Conjecture: a(n) < log(A014574(n))^2. - Thomas Ordowski, Jul 21 2012
Conjecture: All positive integers are represented in this sequence. This is verified up to 184, by searching up to prime indexes of ~128000000. The rate of filling-in the smallest remaining gap among the integers, and the growth in the maximum value found, both slow down considerably relative to a fixed quantity of twin prime incidences examined in each pass. The maximum value found was 237. - Richard R. Forberg, Jul 28 2016
All positive integers below 312 are in this sequence. - Charles R Greathouse IV, Aug 01 2016
From Gus Wiseman, Jun 11 2024: (Start)
Also the length of the n-th maximal antirun of prime numbers > 3, where an antirun is an interval of positions at which consecutive terms differ by more than 2. These begin:
5
7 11
13 17
19 23 29
31 37 41
43 47 53 59
61 67 71
73 79 83 89 97 101
(End)

Crossrefs

First differences of A029707 and A155752 = A029707 - 1. M. F. Hasler, Jul 24 2012
Positions of first appearances are A373401, sorted A373402.
Functional neighbors: A001359, A006512, A251092 or A175632, A373127 (firsts A373128, sorted A373200), A373403, A373405, A373409.
A000040 lists the primes, differences A001223.
A002808 lists the composite numbers, differences A073783.
A046933 counts composite numbers between primes.
A065855 counts composite numbers up to n.

Programs

  • Maple
    A027833 := proc(n)
        local plow,phigh ;
        phigh := A001359(n+1) ;
        plow := A001359(n) ;
        numtheory[pi](phigh)-numtheory[pi](plow) ;
    end proc:
    seq(A027833(n),n=1..100) ; # R. J. Mathar, Jan 20 2025
  • Mathematica
    Differences[Flatten[Position[Differences[Prime[Range[500]]],2]]] (* Harvey P. Dale, Nov 17 2018 *)
    Length/@Split[Select[Range[4,10000],PrimeQ[#]&],#1+2!=#2&]//Most (* Gus Wiseman, Jun 11 2024 *)
  • PARI
    n=1; p=5; forprime(q=7,1e3, if(q-p==2, print1(n", "); n=1, n++); p=q) \\ Charles R Greathouse IV, Aug 01 2016
  • Sage
    def A027833(n) :
       a = [ ]
       st = 2
       for i in (3..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i-st)
             st = i
       return(a)
    A027833(496) # Jani Melik, May 15 2014
    

A037201 Differences between consecutive primes (A001223) but with repeats omitted.

Original entry on oeis.org

1, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 4, 6, 2, 10, 2, 4, 2, 12, 4, 2, 4, 6, 2, 10, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4
Offset: 1

Views

Author

Keywords

Comments

Also the run-compression of the sequence of first differences of prime numbers, where we define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we can remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1). - Gus Wiseman, Sep 16 2024

Crossrefs

This is the run-compression of A001223 = first differences of A000040.
The repeats were at positions A064113 before being omitted.
Adding up runs instead of compressing them gives A373822.
The even terms halved are A373947.
For prime-powers instead of prime numbers we have A376308.
Positions of first appearances are A376520, sorted A376521.
A003242 counts compressed compositions.
A333254 lists run-lengths of differences between consecutive primes.
A373948 encodes compression using compositions in standard order.

Programs

  • Haskell
    a037201 n = a037201_list !! (n-1)
    a037201_list = f a001223_list where
       f (x:xs@(x':_)) | x == x'   = f xs
                       | otherwise = x : f xs
    -- Reinhard Zumkeller, Feb 27 2012
    
  • Mathematica
    Flatten[Split[Differences[Prime[Range[150]]]]/.{(k_)..}:>k] (* based on a program by Harvey P. Dale, Jun 21 2012 *)
  • PARI
    t=0;p=2;forprime(q=3,1e3,if(q-p!=t,print1(q-p", "));t=q-p;p=q) \\ Charles R Greathouse IV, Feb 27 2012

Formula

a(n>1) = 2*A373947(n-1). - Gus Wiseman, Sep 16 2024

Extensions

Offset corrected by Reinhard Zumkeller, Feb 27 2012

A176246 a(n) = A001223(n+1) - 1.

Original entry on oeis.org

1, 1, 3, 1, 3, 1, 3, 5, 1, 5, 3, 1, 3, 5, 5, 1, 5, 3, 1, 5, 3, 5, 7, 3, 1, 3, 1, 3, 13, 3, 5, 1, 9, 1, 5, 5, 3, 5, 5, 1, 9, 1, 3, 1, 11, 11, 3, 1, 3, 5, 1, 9, 5, 5, 5, 1, 5, 3, 1, 9, 13, 3, 1, 3, 13, 5, 9, 1, 3, 5, 7, 5, 5, 3, 5, 7, 3, 7, 9, 1, 9, 1, 5, 3, 5, 7, 3, 1, 3, 11, 7, 3, 7
Offset: 1

Views

Author

Edmund Algeo, Apr 13 2010

Keywords

Comments

Previous name was: Numbers which added to an odd prime plus one, yield the next prime in the series for primes.
Essentially a duplicate of A046933 and A135732. - T. D. Noe, Oct 23 2013

Crossrefs

Cf. A046933 (number of composites between successive primes).

Programs

  • Mathematica
    Differences[Prime[Range[2, 100]]] - 1 (* Paolo Xausa, Jul 02 2025 *)

Formula

a(n) = A001223(n+1) - 1. - Michel Marcus, Jun 08 2013

Extensions

New name using formula from Michel Marcus, Joerg Arndt, Oct 22 2013

A052378 Primes followed by a [4,2,4] prime difference pattern of A001223.

Original entry on oeis.org

7, 13, 37, 97, 103, 223, 307, 457, 853, 877, 1087, 1297, 1423, 1483, 1867, 1993, 2683, 3457, 4513, 4783, 5227, 5647, 6823, 7873, 8287, 10453, 13687, 13873, 15727, 16057, 16063, 16183, 17383, 19417, 19423, 20743, 21013, 21313, 22273, 23053, 23557
Offset: 1

Views

Author

Labos Elemer, Mar 22 2000

Keywords

Comments

The sequence includes A052166, A052168, A022008 and also other primes like 13, 103, 16063 etc.
a(n) is the lesser term of a 4-twin (A023200) after which the next 4-twin comes in minimal distance [here it is 2; see A052380(4/2)].
Analogous prime sequences are A047948, A052376, A052377 and A052188-A052198 with various [d, A052380(d/2), d] difference patterns following a(n).
All terms == 1 (mod 6) - Zak Seidov, Aug 27 2012
Subsequence of A022005. - R. J. Mathar, May 06 2017

Examples

			103 initiates [103,107,109,113] prime quadruple followed by [4,2,4] difference pattern.
		

Crossrefs

Programs

  • Mathematica
    a = {}; Do[If[Prime[x + 3] - Prime[x] == 10, AppendTo[a, Prime[x]]], {x, 1, 10000}]; a (* Zerinvary Lajos, Apr 03 2007 *)
    Select[Partition[Prime[Range[3000]],4,1],Differences[#]=={4,2,4}&][[All,1]] (* Harvey P. Dale, Jun 16 2017 *)
  • PARI
    is(n)=n%6==1 && isprime(n+4) && isprime(n+6) && isprime(n+10) && isprime(n) \\ Charles R Greathouse IV, Apr 29 2015

Formula

a(n) is the initial prime of a [p, p+4, p+6, p+6+4] prime-quadruple consisting of two 4-twins: [p, p+4] and [p+6, p+10].

A052168 Primes at which difference pattern X4242Y (X and Y >= 6) occurs in A001223.

Original entry on oeis.org

1867, 3457, 5647, 15727, 79687, 88807, 101107, 257857, 266677, 276037, 284737, 340927, 354247, 375247, 402757, 419047, 427237, 463447, 470077, 626617, 666427, 736357, 823717, 855727, 959467, 978067, 1022377, 1043587, 1068247, 1118857
Offset: 1

Views

Author

Labos Elemer, Jan 26 2000

Keywords

Comments

All terms are == 7 (mod 30). - Zak Seidov, May 07 2017

Examples

			1867 is here because the successor primes (1867),1871,1873,1877,1879 give 4242 difference pattern. The primes around this island are 1861 and 1889 in distance 6 and 10 resp. Thus the d-pattern "around 1867" is {6,4,2,4,2,10}. [corrected by _Zak Seidov_, May 07 2017]
		

Crossrefs

Programs

  • Mathematica
    m=1867; Reap[Do[While[ PrimeQ[m] m = m + 30]; If[
    m > NextPrime[m, -1] + 5 &&  AllTrue[m + {4, 6, 10, 12}, PrimeQ] && NextPrime[m + 12] > m + 17, Sow[m]]; m = m + 30, {10^5}]][[2, 1]] (* Zak Seidov, May 07 2017 *)

A333215 Lengths of maximal weakly increasing subsequences in the sequence of prime gaps (A001223).

Original entry on oeis.org

4, 2, 3, 2, 1, 4, 2, 1, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 2, 3, 1, 3, 2, 3, 2, 1, 3, 1, 3, 2, 4, 2, 3, 3, 2, 2, 3, 1, 3, 1, 2, 3, 2, 2, 2, 3, 2, 3, 1, 2, 1, 4, 2, 4, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 3, 1, 3, 1, 3, 3, 1, 4, 4, 2, 2, 2, 3, 2, 3, 1, 5, 3, 2, 2, 4, 3, 3
Offset: 1

Views

Author

Gus Wiseman, Mar 14 2020

Keywords

Comments

Prime gaps are differences between adjacent prime numbers.

Examples

			The prime gaps split into the following weakly increasing subsequences: (1,2,2,4), (2,4), (2,4,6), (2,6), (4), (2,4,6,6), (2,6), (4), (2,6), (4,6,8), (4), (2,4), (2,4,14), ...
		

Crossrefs

Prime gaps are A001223.
Ones correspond to strong prime quartets A054804.
Weakly increasing runs of compositions in standard order are A124766.
First differences of A258026 (with zero prepended).
The version for the Kolakoski sequence is A332875.
The weakly decreasing version is A333212.
The unequal version is A333216.
Positions of weak ascents in prime gaps are A333230.
The strictly decreasing version is A333252.
The strictly increasing version is A333253.
The equal version is A333254.

Programs

  • Mathematica
    Length/@Split[Differences[Array[Prime,100]],#1<=#2&]//Most

Formula

Ones correspond to strong prime quartets (A054804), so the sum of terms up to but not including the n-th one is A000720(A054804(n - 1)).

A052162 Primes at which difference pattern X4Y (X and Y >= 6) occurs in A001223.

Original entry on oeis.org

79, 127, 163, 379, 397, 439, 487, 499, 673, 739, 757, 769, 907, 937, 967, 1009, 1213, 1549, 1567, 1579, 1597, 2203, 2293, 2347, 2389, 2437, 2473, 2539, 2617, 2749, 2833, 2857, 2953, 3019, 3037, 3079, 3187, 3217, 3319, 3343, 3613, 3697, 3793, 3877, 3907
Offset: 1

Views

Author

Labos Elemer, Jan 26 2000

Keywords

Examples

			127 is in the sequence because 127 + 4 = 131 is prime, but the difference pattern around 127 is {[113] 14 [127] 4 [131] 6 [137]}.
		

Crossrefs

Programs

  • Mathematica
    s = Differences@ Prime@ Range[600]; Prime@ Select[Position[s, 4][[All, 1]], And[s[[# - 1]] >= 6, s[[# + 1]] >= 6] &] (* Michael De Vlieger, Aug 17 2023 *)

A118922 Primes for which the weight as defined in A117078 is 9 and the gap as defined in A001223 is 8.

Original entry on oeis.org

89, 359, 449, 683, 701, 719, 1439, 1979, 2213, 2609, 2663, 2699, 2843, 2879, 3041, 3221, 3491, 4751, 5399, 5813, 6029, 6389, 6983, 7019, 7919, 8171, 8369, 8513, 9539, 10151, 10169, 10259, 10313, 10781, 10979, 11321, 11519, 11681, 12149, 12203
Offset: 1

Views

Author

Rémi Eismann, May 25 2006, May 04 2007

Keywords

Comments

The prime numbers in this sequence are of the form (18i-1) with i=(level(n)+1)/2, level(n) defined in A117563.

Examples

			a(1) = 89 because of prime(25) = prime(24) + (prime(24)mod 9) = 97
g(n) = 8
		

Crossrefs

A141042 Product of n and the n-th gap between primes: a(n) = n*A001223(n).

Original entry on oeis.org

1, 4, 6, 16, 10, 24, 14, 32, 54, 20, 66, 48, 26, 56, 90, 96, 34, 108, 76, 40, 126, 88, 138, 192, 100, 52, 108, 56, 116, 420, 124, 192, 66, 340, 70, 216, 222, 152, 234, 240, 82, 420, 86, 176, 90, 552, 564, 192, 98, 200, 306, 104
Offset: 1

Views

Author

Omar E. Pol, Jul 30 2008

Keywords

Comments

a(n) is also the area under the curve of the function pi(x) from prime(n) to prime(n+1), see the illustration of initial terms. This sequence is also the first differences of A152535. - Omar E. Pol, Nov 13 2013

Examples

			a(5)=10 because the 5th prime is 11 and the 6th prime is 13. The 5th gap between primes is 2, then a(5)=5*2=10.
		

Crossrefs

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..1001)]:
    seq(n*(P[n+1]-P[n]),n=1..1000); # Robert Israel, Nov 26 2015
  • Mathematica
    Table[n*(Prime[n+1] - Prime[n]), {n, 100}] (* T. D. Noe, Nov 14 2013 *)
    With[{nn=60},Times@@@Thread[{Range[nn],Differences[Prime[Range[nn+1]]]}]] (* Harvey P. Dale, Dec 18 2018 *)
  • PARI
    diff(v)=vector(#v-1, i, (v[i+1]-v[i])*i);
    diff(primes(100)) \\ Altug Alkan, Nov 26 2015

Formula

a(n) = n*(A000040(n+1)-A000040(n)) = n*A001223(n).
a(n) = n*(1 + A046933(n)). [Omar E. Pol, Nov 16 2008]

Extensions

Corrected definition and example. - Omar E. Pol, Nov 16 2008
Name and example corrected by Bob Selcoe and Robert Israel, Nov 26 2015
Showing 1-10 of 981 results. Next