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-7 of 7 results.

A002386 Primes (lower end) with record gaps to the next consecutive prime: primes p(k) where p(k+1) - p(k) exceeds p(j+1) - p(j) for all j < k.

Original entry on oeis.org

2, 3, 7, 23, 89, 113, 523, 887, 1129, 1327, 9551, 15683, 19609, 31397, 155921, 360653, 370261, 492113, 1349533, 1357201, 2010733, 4652353, 17051707, 20831323, 47326693, 122164747, 189695659, 191912783, 387096133, 436273009, 1294268491
Offset: 1

Views

Author

Keywords

Comments

See the links by Jens Kruse Andersen et al. for very large gaps.

References

  • B. C. Berndt, Ramanujan's Notebooks Part IV, Springer-Verlag, see p. 133.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, Sect 6.1, Table 1.
  • M. Kraitchik, Recherches sur la Théorie des Nombres. Gauthiers-Villars, Paris, Vol. 1, 1924, Vol. 2, 1929, see Vol. 1, p. 14.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000040, A001223, A000101 (upper ends), A005250 (record gaps), A000230, A111870, A111943.
See also A205827(n) = A000040(A214935(n)), A182514(n) = A000040(A241540(n)).

Programs

  • Mathematica
    s = {2}; gm = 1; Do[p = Prime[n]; g = Prime[n + 1] - p; If[g > gm, Print[p]; AppendTo[s, p]; gm = g], {n, 2, 1000000}]; s   (* Jean-François Alcover, Mar 31 2011 *)
    Module[{nn=10^7,pr,df},pr=Prime[Range[nn]];df=Differences[pr];DeleteDuplicates[ Thread[ {Most[ pr],df}],GreaterEqual[#1[[2]],#2[[2]]]&]][[All,1]] (* The program generates the first 26 terms of the sequence. *) (* Harvey P. Dale, Sep 24 2022 *)
  • PARI
    a(n)=local(p,g);if(n<2,2*(n>0),p=a(n-1);g=nextprime(p+1)-p;while(p=nextprime(p+1),if(nextprime(p+1)-p>g,break));p) /* Michael Somos, Feb 07 2004 */
    
  • PARI
    p=q=2;g=0;until( g<(q=nextprime(1+p=q))-p && print1(q-g=q-p,","),) \\ M. F. Hasler, Dec 13 2007

Formula

a(n) = A000101(n) - A005250(n) = A008950(n-1) - 1. - M. F. Hasler, Dec 13 2007
A000720(a(n)) = A005669(n).
a(n) = A000040(A005669(n)). - M. F. Hasler, Apr 26 2014

Extensions

Definition clarified by Harvey P. Dale, Sep 24 2022

A008996 Increasing length runs of consecutive composite numbers (records).

Original entry on oeis.org

1, 3, 5, 7, 13, 17, 19, 21, 33, 35, 43, 51, 71, 85, 95, 111, 113, 117, 131, 147, 153, 179, 209, 219, 221, 233, 247, 249, 281, 287, 291, 319, 335, 353, 381, 383, 393, 455, 463, 467, 473, 485, 489, 499, 513, 515, 531, 533, 539, 581, 587, 601, 651, 673, 715, 765
Offset: 1

Views

Author

Mark Cramer (m.cramer(AT)qut.edu.au), Mar 15 1996

Keywords

Comments

Conjecture: a(n) = O(n^2); specifically, a(n) <= n^2. - Alexei Kourbatov, Jan 23 2019

Crossrefs

Programs

  • Haskell
    a008996 n = a008996_list !! (n-1)
    a008996_list = 1 : f 0 (filter (> 1) $
                            map length $ group $ drop 3 a010051_list)
       where f m (u : us) = if u <= m then f m us else u : f u us
    -- Reinhard Zumkeller, Nov 27 2012
  • Mathematica
    maxGap = 1; Reap[ Do[ gap = Prime[n+1] - Prime[n]; If[gap > maxGap, Print[gap-1]; Sow[gap-1]; maxGap = gap], {n, 2, 10^8}]][[2, 1]] (* Jean-François Alcover, Jun 12 2013 *)
    Module[{nn=10^8,cmps},cmps=Table[If[CompositeQ[n],1,{}],{n,nn}];DeleteDuplicates[ Rest[ Length/@ Split[cmps]],GreaterEqual]] (* The program generates the first 24 terms of the sequnece. To generate more, increase the nn constant. *) (* Harvey P. Dale, Sep 04 2022 *)

Formula

a(n) = A005250(n+1) - 1.

Extensions

More terms from Warren D. Smith, Dec 11 2000
a(40) corrected by Bert Sierra, Jul 12 2025

A008995 Increasing length runs of consecutive composite numbers (endpoints).

Original entry on oeis.org

4, 10, 28, 96, 126, 540, 906, 1150, 1360, 9586, 15726, 19660, 31468, 156006, 360748, 370372, 492226, 1349650, 1357332, 2010880, 4652506, 17051886, 20831532, 47326912, 122164968, 189695892, 191913030
Offset: 1

Views

Author

Mark Cramer (m.cramer(AT)qut.edu.au). Computed by Dennis Yelle (dennis(AT)netcom.com)

Keywords

References

  • Netnews group rec.puzzles, circa Mar 01 1996 (I would like to get the exact reference).

Crossrefs

Programs

  • Mathematica
    maxGap = 1; Reap[ Do[ gap = Prime[n + 1] - (p = Prime[n]); If[gap > maxGap, Print[p + gap - 1]; Sow[p + gap - 1]; maxGap = gap], {n, 2, 10^8}]][[2, 1]] (* Jean-François Alcover, Jun 12 2013 *)

Formula

a(n) = A000101(n+1)-1.

A030296 Smallest start for a run of at least n composite numbers.

Original entry on oeis.org

4, 8, 8, 24, 24, 90, 90, 114, 114, 114, 114, 114, 114, 524, 524, 524, 524, 888, 888, 1130, 1130, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 9552, 9552, 15684, 15684, 15684, 15684, 15684, 15684, 15684, 15684, 19610, 19610, 19610
Offset: 1

Views

Author

Keywords

Comments

a(n) is even, since a(n)-1 is a prime > 2, by the minimality of a(n). - Jonathan Sondow, May 31 2014
Except for a(1), records occur at even values of n, and each term appears an even number of times consecutively. (Proof. A maximal run of composites must begin and end at even numbers.) - Jonathan Sondow, May 31 2014

Examples

			a(5) = 24 as 24 is the first of the five consecutive composite numbers 24, 25, 26, 27, 28.
		

References

  • Amarnath Murthy, Some more conjectures on primes and divisors, Smarandache Notions Journal, Vol. 12, No. 1-2-3, Spring 2001.

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = For[p1 = a[n-1]-1; p2 = NextPrime[p1], True, p1 = p2; p2 = NextPrime[p1], If[ p2-p1-1 >= n, Return[p1+1]]]; a[1] = 4; Table[a[n], {n, 1, 43}] (* Jean-François Alcover, May 24 2012 *)
    Module[{nn=20000,cmps},cmps=Table[If[CompositeQ[n],1,0],{n,nn}];Table[ SequencePosition[ cmps,PadRight[{},k,1],1][[1,1]],{k,50}]] (* Harvey P. Dale, Jan 01 2022 *)

Formula

a(n) = A104138(n) + 1. - Jonathan Sondow, May 31 2014

A056784 First nonprime in a sequence of consecutive nonprimes which is at least twice as long as any earlier run of consecutive nonprimes in this list.

Original entry on oeis.org

1, 8, 90, 524, 9552, 31398, 2010734, 2300942550, 2614941710600, 352521223451364324
Offset: 1

Views

Author

Keywords

Examples

			2300942550 is the first of 319 consecutive composite numbers.
2614941710600 is the first of 651 consecutive composite numbers.
352521223451364324 is the first of 1327 consecutive composite numbers.
		

Crossrefs

Extensions

Corrected by R. J. Mathar, Sep 29 2006
Three more terms from Donovan Johnson, Jan 28 2008

A383969 a(n) is the smallest even number m such that the set {m+1, m+3, m+5, ..., m+(2*n-1)} contains no prime numbers.

Original entry on oeis.org

0, 24, 90, 114, 114, 114, 524, 524, 888, 1130, 1328, 1328, 1328, 1328, 1328, 1328, 9552, 15684, 15684, 15684, 15684, 19610, 19610, 19610, 19610, 31398, 31398, 31398, 31398, 31398, 31398, 31398, 31398, 31398, 31398, 155922, 155922, 155922, 155922, 155922, 155922, 155922
Offset: 1

Views

Author

David James Sycamore, May 16 2025

Keywords

Comments

For a(2) onward, consists of terms of A008950(n), perhaps repeated, based on the increase in records. So, higher terms may be easily computed using the b-files at A008950 and A002386. - Michael S. Branicky, May 23 2025

Examples

			a(1) = 0 since 0 is the smallest even number such that 0 + 1 = 1 is not prime
a(2) = 24 since there are no primes in {24+1, 24+3} = {25, 27} and no smaller even number has this property.
a(3) = 90 since there are no primes in {91, 93, 95}, and no smaller even number has this property.
		

Crossrefs

Programs

  • Mathematica
    k = 0; Table[While[AnyTrue[k + Range[2*n - 1], PrimeQ], k += 2]; k, {n, 42}] (* Michael De Vlieger, Jun 01 2025 *)
  • Python
    from sympy import isprime
    from itertools import count
    def a(n): return next(m for m in count(0, 2) if all(not isprime(m+2*i+1) for i in range(n)))
    print([a(n) for n in range(1, 43)]) # Michael S. Branicky, May 23 2025

Extensions

a(4) and beyond from Michael S. Branicky, May 23 2025

A175839 Smallest runs of n*2-1 consecutive composites.

Original entry on oeis.org

4, 8, 9, 10, 24, 25, 26, 27, 28, 90, 91, 92, 93, 94, 95, 96, 114, 115, 116, 117, 118, 119, 120, 121, 122, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126
Offset: 1

Views

Author

Grant Garcia, Sep 20 2010

Keywords

Comments

Even lengths of runs of composites are omitted, as nontrivial runs always have odd lengths (see A046933).
Run 5 (starting at 114) has 13 consecutive composites and is repeated in runs 6 and 7. Run 8 starts at 524 = A008950(6).

Examples

			Run 1 has length 1; the first composite is 4.
Run 2 has length 3; the first three consecutive composites are 8, 9, and 10.
Run 3 has length 5; the first five consecutive composites are 24, 25, 26, 27, and 28.
4;
8, 9, 10;
24, 25, 26, 27, 28;
90, 91, 92, 93, 94, 95, 96;
114, 115, 116, 117, 118, 119, 120, 121, 122;
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124;
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126;
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    out = []
    run = 1
    for n in range(4, 10000):
        isrun = True
        for o in range(run): isrun *= not isprime(n + o - run)
        if isrun:
            for o in range(run): out.append(n + o - run)
            run += 2
    print(out)
Showing 1-7 of 7 results.