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

A122412 Indices of primes occurring in A031133.

Original entry on oeis.org

1, 2, 3, 8, 15, 23, 29, 46, 188, 216, 326, 367, 738, 1183, 1662, 2224, 2225, 3384, 3385, 4058, 5948, 14356, 30802, 31544, 33608, 104070, 118504, 325851, 597310, 1319944, 2324139, 4140008, 4258994, 5911613, 8040877, 17567976, 23163297, 25203779
Offset: 1

Views

Author

Jon E. Schoenfield, Sep 02 2006

Keywords

Examples

			a(4)=8 because the 4th term of A031133 is the 8th prime number.
		

Crossrefs

Formula

a(n) = pi(A031133(n)).

A031131 Difference between n-th prime and (n+2)-nd prime.

Original entry on oeis.org

3, 4, 6, 6, 6, 6, 6, 10, 8, 8, 10, 6, 6, 10, 12, 8, 8, 10, 6, 8, 10, 10, 14, 12, 6, 6, 6, 6, 18, 18, 10, 8, 12, 12, 8, 12, 10, 10, 12, 8, 12, 12, 6, 6, 14, 24, 16, 6, 6, 10, 8, 12, 16, 12, 12, 8, 8, 10, 6, 12, 24, 18, 6, 6, 18, 20, 16, 12, 6, 10, 14, 14, 12, 10, 10, 14, 12, 12, 18, 12, 12, 12
Offset: 1

Views

Author

Keywords

Comments

Distance between the pair of primes adjacent to the (n+1)-st prime. - Lekraj Beedassy, Oct 01 2004 [Typo corrected by Zak Seidov, Feb 22 2009]
A031131(A261525(n)) = 2*n and A031131(m) != 2*n for m < A261525(n). - Reinhard Zumkeller, Aug 23 2015
The Polymath project 8b proved that a(n) <= 395106 infinitely often (their published paper contains the slightly weaker bound a(n) <= 398130 infinitely often). - Charles R Greathouse IV, Jul 22 2016

Examples

			a(10)=8 because the 10th prime=29 is followed by primes 31 and 37, and 37 - 29 = 8.
		

Crossrefs

Sum of consecutive terms of A001223.
Cf. A075527 (allowing 1 to be prime).
First differences of A001043.

Programs

  • Haskell
    a031131 n = a031131_list !! (n-1)
    a031131_list = zipWith (-) (drop 2 a000040_list) a000040_list
    -- Reinhard Zumkeller, Dec 19 2013
  • Magma
    [NthPrime(n+2)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 11 2011
    
  • Maple
    P:= select(isprime, [2,seq(2*i+1,i=1..1000)]):
    P[3..-1] - P[1..-3]; # Robert Israel, Jan 25 2015
  • Mathematica
    Differences[lst_]:=Drop[lst,2]-Drop[lst,-2]; Differences[Prime[Range[123]]] (* Vladimir Joseph Stephan Orlovsky, Aug 13 2009 *)
    Map[#3 - #1 & @@ # &, Partition[Prime@ Range[84], 3, 1]] (* Michael De Vlieger, Dec 17 2017 *)
  • MuPAD
    ithprime(i+2)-ithprime(i) $ i = 1..65 // Zerinvary Lajos, Feb 26 2007
    
  • PARI
    a(n)=my(p=prime(n));nextprime(nextprime(p+1)+1)-p \\ Charles R Greathouse IV, Jul 01 2013
    
  • Sage
    BB = primes_first_n(67)
    L = []
    for i in range(65):
        L.append(BB[2+i]-BB[i])
    L
    # Zerinvary Lajos, May 14 2007
    

Formula

a(n) = A001223(n) + A001223(n-1). - Lior Manor, Jan 19 2005
a(n) = A000040(n+2) - A000040(n).
a(n) = 2*A052288(n-1) for n>1. - Hugo Pfoertner, Apr 16 2025

Extensions

Corrected by T. D. Noe, Sep 11 2008
Edited by N. J. A. Sloane, Sep 18 2008, at the suggestion of T. D. Noe

A031132 Record differences between n-th prime and (n+2)-nd prime.

Original entry on oeis.org

3, 4, 6, 10, 12, 14, 18, 24, 28, 40, 42, 44, 48, 50, 56, 58, 72, 76, 80, 82, 100, 114, 116, 126, 138, 140, 160, 190, 200, 234, 236, 246, 248, 270, 306, 328, 330, 336, 340, 372, 376, 410, 436, 438, 450, 476, 502, 506, 524, 540, 546, 594, 600, 624, 678, 690, 700, 760, 780, 838, 900, 944, 972, 1014, 1016, 1032, 1152
Offset: 1

Views

Author

Keywords

Examples

			The difference a(49) = 524 first occurs at prime(2158173265) - prime(2158173263) = 50949283633 - 50949283109 = 524. - _Jon E. Schoenfield_, Aug 29 2006
		

Crossrefs

See A031133 for lower primes and A031134 for upper primes.

Programs

  • Mathematica
    d = 0; lst = {}; {p, q, r} = {1, 2, 3}; Do[{p, q, r} = {q, r, Prime@n}; If[r - p > d, d = r - p; AppendTo[lst, {p, r}]; Print[{p, r-p, r}]], {n, 212550893}]; Last /@ lst - First /@ lst (* Robert G. Wilson v, May 17 2006 *)
    dist = 0; n = 0; While[n<250000000, n++; tmp = Prime[n + 2] - Prime[n]; If[tmp > dist, dist = tmp; Print[tmp]];]; (* Sam Handler (sam_5_5_5_0(AT)yahoo.com), Aug 08 2006 *)

Formula

Extensions

Extended (and first term added) by Patrick De Geest, Oct 15 2000
Further extended by Jud McCranie, Jan 03 2001 and again on May 18 2006
a(50)-a(52) from Jon E. Schoenfield, Sep 02 2006
a(53)-a(55) from Dmitry Kamenetsky, Jul 28 2008
a(55) corrected, a(56)-a(62) added by Dmitry Petukhov, Sep 22 2015
a(63)-a(67) added by Vladimir Chirkov and Natalia Makarova, Sep 24 2015, Sep 29 2015

A031134 Upper prime of a record difference between it and the second prime before it.

Original entry on oeis.org

5, 7, 11, 29, 59, 97, 127, 223, 1151, 1361, 2203, 2521, 5639, 9601, 14143, 19661, 19681, 31469, 31477, 38543, 58889, 156007, 360769, 370373, 396871, 1357333, 1562051, 4652507, 8917663, 20831533, 38089453, 70396589, 72546391, 102765847
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    lst = {}; {p, q, r} = {1, 2, 3}; d = 0; Do[{p, q, r} = {q, r, Prime@n}; If[r - p > d, d = r - p; AppendTo[lst, {p, r}]; Print[{p, r-p, r}]], {n, 8050000}]; Last /@ lst (* Robert G. Wilson v, May 17 2006 *)

Formula

Extensions

Extended (and first term added) by Patrick De Geest, Oct 15 2000
Corrected and extended by Jud McCranie, Jan 03 2001
a(34)-a(52) from Jon E. Schoenfield, Sep 02 2006
Definition corrected by Jon E. Schoenfield, Aug 27 2006
a(53)-a(55) added by Dmitry Kamenetsky, Jul 28 2008
a(55) corrected, a(56)-a(62) added by Dmitry Petukhov, Sep 20 2015
a(63)-a(67) added by Vladimir Chirkov and Natalia Makarova, Sep 25 2015, Sep 29 2015

A122413 Indices of primes occurring in A031134.

Original entry on oeis.org

3, 4, 5, 10, 17, 25, 31, 48, 190, 218, 328, 369, 740, 1185, 1664, 2226, 2227, 3386, 3387, 4060, 5950, 14358, 30804, 31546, 33610, 104072, 118506, 325853, 597312, 1319946, 2324141, 4140010, 4258996, 5911615, 8040879, 17567978, 23163299, 25203781
Offset: 1

Views

Author

Jon E. Schoenfield, Sep 02 2006

Keywords

Examples

			a(4)=10 because the 4th term of A031134 is the 10th prime number.
		

Crossrefs

Formula

a(n) = pi(A031134(n)).
Showing 1-5 of 5 results.