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

A001223 Prime gaps: differences between consecutive primes.

Original entry on oeis.org

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, 4, 6, 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 10, 6, 6, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4, 2, 4, 12, 8, 4, 8, 4, 6, 12
Offset: 1

Views

Author

Keywords

Comments

There is a unique decomposition of the primes: provided the weight A117078(n) is > 0, we have prime(n) = weight * level + gap, or A000040(n) = A117078(n) * A117563(n) + a(n). - Rémi Eismann, Feb 14 2008
Let rho(m) = A179196(m), for any n, let m be an integer such that p_(rho(m)) <= p_n and p_(n+1) <= p_(rho(m+1)), then rho(m) <= n < n + 1 <= rho(m + 1), therefore a(n) = p_(n+1) - p_n <= p_rho(m+1) - p_rho(m) = A182873(m). For all rho(m) = A179196(m), a(rho(m)) < A165959(m). - John W. Nicholson, Dec 14 2011
A solution (modular square root) of x^2 == A001248(n) (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
There exists a constant C such that for n -> infinity, Cramer conjecture a(n) < C log^2 prime(n) is equivalent to (log prime(n+1)/log prime(n))^n < e^C. - Thomas Ordowski, Oct 11 2014
a(n) = A008347(n+1) - A008347(n-1). - Reinhard Zumkeller, Feb 09 2015
Yitang Zhang proved lim inf_{n -> infinity} a(n) is finite. - Robert Israel, Feb 12 2015
lim sup_{n -> infinity} a(n)/log^2 prime(n) = C <==> lim sup_{n -> infinity}(log prime(n+1)/log prime(n))^n = e^C. - Thomas Ordowski, Mar 09 2015
a(A038664(n)) = 2*n and a(m) != 2*n for m < A038664(n). - Reinhard Zumkeller, Aug 23 2015
If j and k are positive integers then there are no two consecutive primes gaps of the form 2+6j and 2+6k (A016933) or 4+6j and 4+6k (A016957). - Andres Cicuttin, Jul 14 2016
Conjecture: For any positive numbers x and y, there is an index k such that x/y = a(k)/a(k+1). - Andres Cicuttin, Sep 23 2018
Conjecture: For any three positive numbers x, y and j, there is an index k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Conjecture: For any three positive numbers x, y and j, there are infinitely many indices k such that x/y = a(k)/a(k+j). - Andres Cicuttin, Sep 29 2018
Row m of A174349 lists all indices n for which a(n) = 2m. - M. F. Hasler, Oct 26 2018
Since (6a, 6b) is an admissible pattern of gaps for any integers a, b > 0 (and also if other multiples of 6 are inserted in between), the above conjecture follows from the prime k-tuple conjecture which states that any admissible pattern occurs infinitely often (see, e.g., the Caldwell link). This also means that any subsequence a(n .. n+m) with n > 2 (as to exclude the untypical primes 2 and 3) should occur infinitely many times at other starting points n'. - M. F. Hasler, Oct 26 2018
Conjecture: Defining b(n,j,k) as the number of pairs of prime gaps {a(i),a(i+j)} such that i < n, j > 0, and a(i)/a(i+j) = k with k > 0, then
lim_{n -> oo} b(n,j,k)/b(n,j,1/k) = 1, for any j > 0 and k > 0, and
lim_{n -> oo} b(n,j,k1)/b(n,j,k2) = C with C = C(j,k1,k2) > 0. - Andres Cicuttin, Sep 01 2019

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 92.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 186-192.
  • 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 (primes), A001248 (primes squared), A000720, A037201, A007921, A030173, A036263-A036274, A167770, A008347.
Second difference is A036263, first occurrence is A000230.
For records see A005250, A005669.
Sequences related to the differences between successive primes: A001223 (Delta(p)), A028334, A080378, A104120, A330556-A330561.

Programs

  • Haskell
    a001223 n = a001223_list !! (n-1)
    a001223_list = zipWith (-) (tail a000040_list) a000040_list
    -- Reinhard Zumkeller, Oct 29 2011
    
  • Magma
    [(NthPrime(n+1) - NthPrime(n)): n in [1..100]]; // Vincenzo Librandi, Apr 02 2011
    
  • Maple
    with(numtheory): for n from 1 to 500 do printf(`%d,`,ithprime(n+1) - ithprime(n)) od:
  • Mathematica
    Differences[Prime[Range[100]]] (* Harvey P. Dale, May 15 2011 *)
  • PARI
    diff(v)=vector(#v-1,i,v[i+1]-v[i]);
    diff(primes(100)) \\ Charles R Greathouse IV, Feb 11 2011
    
  • PARI
    forprime(p=1, 1e3, print1(nextprime(p+1)-p, ", ")) \\ Felix Fröhlich, Sep 06 2014
    
  • Python
    from sympy import prime
    def A001223(n): return prime(n+1)-prime(n) # Chai Wah Wu, Jul 07 2022
  • Sage
    differences(prime_range(1000)) # Joerg Arndt, May 15 2011
    

Formula

G.f.: b(x)*(1-x), where b(x) is the g.f. for the primes. - Franklin T. Adams-Watters, Jun 15 2006
a(n) = prime(n+1) - prime(n). - Franklin T. Adams-Watters, Mar 31 2010
Conjectures: (i) a(n) = ceiling(prime(n)*log(prime(n+1)/prime(n))). (ii) a(n) = floor(prime(n+1)*log(prime(n+1)/prime(n))). (iii) a(n) = floor((prime(n)+prime(n+1))*log(prime(n+1)/prime(n))/2). - Thomas Ordowski, Mar 21 2013
A167770(n) == a(n)^2 (mod A000040(n+1)). - L. Edson Jeffery, Oct 01 2014
a(n) = Sum_{k=1..2^(n+1)-1} (floor(cos^2(Pi*(n+1)^(1/(n+1))/(1+primepi(k))^(1/(n+1))))). - Anthony Browne, May 11 2016
G.f.: (Sum_{k>=1} x^pi(k)) - 1, where pi(k) is the prime counting function. - Benedict W. J. Irwin, Jun 13 2016
Conjecture: Limit_{N->oo} (Sum_{n=2..N} log(a(n))) / (Sum_{n=2..N} log(log(prime(n)))) = 1. - Alain Rocchelli, Dec 16 2022
Conjecture: The asymptotic limit of the average of log(a(n)) ~ log(log(prime(n))) - gamma (where gamma is Euler's constant). Also, for n tending to infinity, the geometric mean of a(n) is equivalent to log(prime(n)) / e^gamma. - Alain Rocchelli, Jan 23 2023
It has been conjectured that primes are distributed around their average spacing in a Poisson distribution (cf. D. A. Goldston in above links). This is the basis of the last two conjectures above. - Alain Rocchelli, Feb 10 2023

Extensions

More terms from James Sellers, Feb 19 2001

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

A031165 a(n) = prime(n+3) - prime(n).

Original entry on oeis.org

5, 8, 8, 10, 8, 10, 12, 12, 14, 12, 12, 10, 12, 16, 14, 14, 12, 12, 12, 12, 16, 18, 18, 14, 10, 8, 10, 20, 22, 24, 12, 18, 14, 18, 14, 16, 16, 16, 14, 18, 14, 16, 8, 18, 26, 28, 18, 10, 12, 12, 18, 18, 22, 18, 14, 14, 12, 12, 16, 26, 28, 20, 10, 20, 24, 30, 18, 16, 12
Offset: 1

Views

Author

Jeff Burch, Dec 11 1999

Keywords

Comments

Comments from Jonathan Vos Post, Jan 22 2006 (Start): This sequence is the k=3 case of the family of sequences a(k,n) = prime(n+k) - prime(n). See A001223 and A031131 for k = 1 and 2.
The records in this sequence give A115401. The minimal value, after the anomalous initial values (5, 8, 8), is 8 which occurs iff n is an element of A007530 (prime quadruples: numbers n such that n, n+2, n+6, n+8 are all prime). (End)

Examples

			a(1) = prime(4) - prime(1) = 7 - 2 = 5, which is the only odd element of this sequence.
a(2) = prime(5) - prime(2) = 11 - 3 = 8.
a(3) = prime(6) - prime(3) = 13 - 5 = 8.
a(4) = prime(7) - prime(4) = 17 - 7 = 10.
a(99) = prime(102) - prime(99) = 557 - 523 = 34. - _Jonathan Vos Post_, Jan 22 2006
		

Crossrefs

Programs

  • Haskell
    a031165 n = a031165_list !! (n-1)
    a031165_list = zipWith (-) (drop 3 a000040_list) a000040_list
    -- Reinhard Zumkeller, Aug 23 2015
  • Magma
    [NthPrime(n+3)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 11 2011
    
  • Maple
    a:= n-> ithprime(n+3)-ithprime(n): seq (a(n), n=1..80);
  • Mathematica
    t = Array[Prime, 75]; Drop[t, 3] - Drop[t, -3] (* Robert G. Wilson v *)
    #[[4]]-#[[1]]&/@Partition[Prime[Range[80]],4,1] (* Harvey P. Dale, Nov 07 2021 *)
  • PARI
    p=2;q=3;r=5;forprime(s=7,1e3,print1(s-p", "); p=q;q=r;r=s) \\ Charles R Greathouse IV, Nov 07 2012
    

Formula

a(n) = prime(n+3) - prime(n). a(n) = A000040(n+3) - A000040(n). - Jonathan Vos Post, Jan 22 2006
a(n) = A034961(n+1) - A034961(n). - Zak Seidov, Nov 07 2012

Extensions

Edited by R. J. Mathar and N. J. A. Sloane, Aug 11 2008

A031172 a(n) = prime(n+10) - prime(n).

Original entry on oeis.org

29, 34, 36, 36, 36, 40, 42, 42, 44, 42, 42, 42, 42, 46, 50, 48, 44, 46, 42, 42, 54, 52, 54, 50, 52, 50, 54, 56, 58, 60, 52, 50, 54, 54, 48, 48, 54, 60, 60, 56, 54, 58, 50, 58, 60, 64, 58, 48, 50, 52, 50, 54, 66, 60, 56, 54, 62, 66, 70, 68, 70, 66, 60, 62, 66, 66, 58
Offset: 1

Views

Author

Keywords

Comments

In principle, moderate values should appear infinitely many times, by analogy with twin primes hypothesis. For example, a(n) = 44 for n = 9, 17, 206, 1604467, 12905293, 18008874, 26545460, 32655424, 57848470, 58313630, 59022635, 66275281, 81581956, 123780499, 160884754, 167797255, 179786560, 181569324, 239542290, ... - Zak Seidov, Sep 14 2014, edited by M. F. Hasler, Dec 03 2018
According to the k-tuple conjecture, any admissible k-tuple of primes occurs with calculable nonzero asymptotic density, i.e., in particular, infinitely many times. For k = 11, number of primes in the interval [prime(n), prime(n+10)], the smallest possible diameter of a k-tuple is A008407(11) = 36, and there are A083409(11) = 2 such constellations: {0, 4, 6, 10, 16, 18, 24, 28, 30, 34, 36}, first occurring at A213646(1) = 1418575498573, and {0, 2, 6, 8, 12, 18, 20, 26, 30, 32, 36}, first occurring at A213647(1) = 11. The combined list { prime(n) | a(n) = 36 } is A257129. - M. F. Hasler, Dec 03 2018

Crossrefs

Programs

  • GAP
    P:=Filtered([1..400],IsPrime);; a:=List([1..Length(P)-10],n->P[n+10]-P[n]); # Muniru A Asiru, Dec 06 2018
  • Haskell
    a031172_list = zipWith (-) (drop 10 a000040_list) a000040_list
    a031172 n = a031172_list !! (n-1)  -- Reinhard Zumkeller, Aug 23 2015
    
  • Magma
    [NthPrime(n+10)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 23 2011
    
  • Maple
    A031172:=n->ithprime(n+10)-ithprime(n): seq(A031172(n), n=1..50);
  • Mathematica
    Table[Prime[n + 10] - Prime[n], {n, 50}] (* Wesley Ivan Hurt, Sep 14 2014 *)
  • PARI
    A031172(n)=prime(n+10)-prime(n) \\ M. F. Hasler, Dec 03 2018
    
  • Python
    from sympy import prime
    for n in range(1,100): print(prime(n+10)-prime(n)) # Stefano Spezia, Dec 06 2018
    
  • Sage
    [(nth_prime(n+10) - nth_prime(n)) for n in (1..100)] # G. C. Greubel, Dec 04 2018
    

Formula

a(n) = A000040(n+10) - A000040(n). - Wesley Ivan Hurt, Sep 14 2014

Extensions

Offset changed from 2 to 1; added a(1)=29 by Vincenzo Librandi, Apr 23 2011

A031166 a(n) = prime(n+4) - prime(n).

Original entry on oeis.org

9, 10, 12, 12, 12, 16, 14, 18, 18, 14, 16, 16, 18, 18, 20, 18, 14, 18, 16, 18, 24, 22, 20, 18, 12, 12, 24, 24, 28, 26, 22, 20, 20, 24, 18, 22, 22, 18, 24, 20, 18, 18, 20, 30, 30, 30, 22, 16, 14, 22, 24, 24, 28, 20, 20, 18, 14, 22, 30, 30, 30, 24, 24, 26, 34, 32, 22
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

Formula

a(n) = A031131(n) + A031131(n+2) = A001223(n) + A031165(n+1) and obvious variants. - M. F. Hasler, Dec 03 2018

Extensions

Offset changed from 2 to 1, and a(1)=9 added, by Vincenzo Librandi, Apr 23 2011

A031167 a(n) = prime(n+5) - prime(n).

Original entry on oeis.org

11, 14, 14, 16, 18, 18, 20, 22, 20, 18, 22, 22, 20, 24, 24, 20, 20, 22, 22, 26, 28, 24, 24, 20, 16, 26, 28, 30, 30, 36, 24, 26, 26, 28, 24, 28, 24, 28, 26, 24, 20, 30, 32, 34, 32, 34, 28, 18, 24, 28, 30, 30, 30, 26, 24, 20, 24, 36, 34, 32, 34, 38, 30, 36, 36, 36, 28
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a031167 n = a031167_list !! (n-1)
    a031167_list = zipWith (-) (drop 5 a000040_list) a000040_list
    -- Reinhard Zumkeller, Aug 23 2015
  • Magma
    [NthPrime(n+5)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 23 2011
    
  • Maple
    seq(ithprime(n+5)-ithprime(n), n=1..30);
  • Mathematica
    a=5; t=Array[Prime,123]; Drop[t,a]-Drop[t,-a] (* Vladimir Joseph Stephan Orlovsky, Aug 13 2009 *)
    Last[#]-First[#]&/@Partition[Prime[Range[80]],6,1] (* Harvey P. Dale, Jul 11 2014 *)
  • PARI
    A031167(n) = prime(n+5)-prime(n)
    

Extensions

Initial term added by Michael B. Porter, Jan 27 2010

A031168 a(n) = prime(n+6) - prime(n).

Original entry on oeis.org

15, 16, 18, 22, 20, 24, 24, 24, 24, 24, 28, 24, 26, 28, 26, 26, 24, 28, 30, 30, 30, 28, 26, 24, 30, 30, 34, 32, 40, 38, 30, 32, 30, 34, 30, 30, 34, 30, 30, 26, 32, 42, 36, 36, 36, 40, 30, 28, 30, 34, 36, 32, 36, 30, 26, 30, 38, 40, 36, 36, 48, 44, 40, 38, 40, 42, 36
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a031168 n = a031168_list !! (n-1)
    a031168_list = zipWith (-) (drop 6 a000040_list) a000040_list
    -- Reinhard Zumkeller, Aug 23 2015
  • Magma
    [NthPrime(n+6)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 23 2011
    
  • Maple
    seq(ithprime(n+6)-ithprime(n), n=1..70);
  • Mathematica
    a=6; t=Array[Prime,123]; Drop[t,a]-Drop[t,-a] (* Vladimir Joseph Stephan Orlovsky, Aug 13 2009 *)
    Last[#]-First[#]&/@Partition[Prime[Range[80]],7,1] (* Harvey P. Dale, Jan 12 2012 *)

Extensions

Offset changed from 2 to 1, and a(1)=15 added, by Vincenzo Librandi, Apr 23 2011

A031170 a(n) = prime(n+8) - prime(n).

Original entry on oeis.org

21, 26, 26, 30, 30, 30, 30, 34, 36, 32, 36, 34, 32, 36, 36, 36, 38, 40, 36, 36, 36, 34, 44, 42, 40, 38, 46, 44, 48, 50, 40, 42, 42, 42, 42, 42, 40, 36, 44, 50, 48, 48, 42, 46, 44, 52, 46, 40, 42, 42, 44, 42, 42, 42, 50, 48, 44, 46, 54, 56, 64, 56, 46, 48, 54, 56, 48
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a031170 n = a031170_list !! (n-1)
    a031170_list = zipWith (-) (drop 8 a000040_list) a000040_list
    -- Reinhard Zumkeller, Aug 23 2015
  • Magma
    [NthPrime(n+8)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 23 2011
    
  • Maple
    ithprime(n+8)-ithprime(n);
  • Mathematica
    Table[Prime[n+8]-Prime[n],{n,1,100}]  (* Harvey P. Dale, Mar 23 2011 *)

Formula

a(n) = A000040(n+8) - A000040(n). - Zak Seidov, Mar 23 2011

A031171 a(n) = prime(n+9) - prime(n).

Original entry on oeis.org

27, 28, 32, 34, 32, 34, 36, 40, 38, 38, 40, 36, 38, 40, 42, 44, 42, 42, 40, 38, 40, 48, 48, 48, 42, 48, 48, 50, 54, 54, 46, 48, 44, 52, 44, 46, 42, 48, 56, 54, 50, 52, 48, 48, 54, 58, 52, 46, 44, 48, 48, 44, 52, 56, 54, 50, 48, 60, 60, 66, 66, 60, 52, 56, 60, 62, 52
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a031171 n = a031171_list !! (n-1)
    a031171_list = zipWith (-) (drop 9 a000040_list) a000040_list
    -- Reinhard Zumkeller, Aug 23 2015
  • Magma
    [NthPrime(n+9)-NthPrime(n): n in [1..100] ]; // Vincenzo Librandi, Apr 23 2011
    
  • Maple
    ithprime(n+9)-ithprime(n);
  • Mathematica
    Table[Prime[n+9]-Prime[n],{n,80}] (* Harvey P. Dale, Jan 29 2023 *)

Extensions

Offset changed from 2 to 1 and a(1)=27 inserted by Vincenzo Librandi, Apr 23 2011

A261518 a(n+1) = prime(n + a(n)) - prime(n), a(1) = 1.

Original entry on oeis.org

1, 1, 2, 6, 22, 92, 508, 3674, 34452, 408104, 5925564, 103023888, 2102941162, 49588317960, 1332831700026, 40376512041704, 1365483356241318, 51130344360226830, 2104788801045148866, 94659739599219674872, 4625501078986781603540, 244380566194237434434094
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 23 2015

Keywords

Crossrefs

Programs

  • Haskell
    a261518 n = a261518_list !! (n - 1)
    a261518_list = 1 : zipWith (-)
                   (map a000040 (zipWith (+) a261518_list [1..])) a000040_list
    
  • Magma
    [1] cat [n le 1 select 1 else  NthPrime(n + Self(n-1)) - NthPrime(n): n in [1..12]]; // Vincenzo Librandi, Aug 24 2015
    
  • Mathematica
    FoldList[(Prime[#2+#1]-Prime[#2])&,1,Range@15] (* Ivan N. Ianakiev, Aug 23 2015 *)
    RecurrenceTable[{a[n+1] == Prime[n+a[n]] - Prime[n], a[1]==1}, a, {n, 1,16}] (* G. C. Greubel, Aug 24 2015 *)
    nxt[{n_,a_}]:={n+1,Prime[n+a]-Prime[n]}; NestList[nxt,{1,1},16][[All,2]] (* Harvey P. Dale, May 15 2018 *)
  • PARI
    a(n) = if(n==1, 1, prime(n-1 + a(n-1)) - prime(n-1));
    vector(12, n, a(n)) \\ Altug Alkan, Oct 05 2015
    
  • Python
    # see LINKS

Extensions

a(13)-a(16) from Ivan N. Ianakiev, Aug 23 2015
a(17)-a(19) from Jinyuan Wang, Jun 27 2020
a(20)-a(22) from Lucas A. Brown, Mar 18 2024
Showing 1-10 of 10 results.