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.

A138383 If prime(i) = i-th prime, a(n) = prime(n)+1 + prime(n)+2 + ... + prime(n+1). a(0) = 3 by convention.

Original entry on oeis.org

3, 3, 9, 13, 38, 25, 62, 37, 86, 159, 61, 207, 158, 85, 182, 303, 339, 121, 387, 278, 145, 459, 326, 519, 748, 398, 205, 422, 217, 446, 1687, 518, 807, 277, 1445, 301, 927, 963, 662, 1023, 1059, 361, 1865, 385, 782, 397, 2466, 2610, 902, 457, 926, 1419, 481, 2465, 1527
Offset: 0

Views

Author

Odimar Fabeny, May 08 2008

Keywords

Comments

First differences of A034953 for n > 0. - Gionata Neri, May 17 2015

Examples

			3 = 1 + 2;
3 = 3;
9 = 4 + 5;
13 = 6 + 7;
38 = 8 + 9 + 10 + 11;
...
		

Crossrefs

Cf. A000040.

Programs

  • Magma
    [3] cat [(NthPrime(n+1) - NthPrime(n))*(NthPrime(n+1) + NthPrime(n)+1)/2: n in [1..60]]; // Vincenzo Librandi, May 18 2015
    
  • Maple
    3, seq((ithprime(n+1)-ithprime(n))*(ithprime(n+1)+ithprime(n)+1)/2, n=1..100); # Robert Israel, May 17 2015
  • Mathematica
    Join[{3}, Table[(Prime[n+1] - Prime[n]) (Prime[n+1] + Prime[n] + 1)/2, {n, 60}]] (* Vincenzo Librandi, May 18 2015 *)
    Join[{3},(#[[2]]-#[[1]]) (Total[#]+1)/2&/@Partition[Prime[Range[ 60]],2,1]] (* Harvey P. Dale, Oct 27 2020 *)
  • Python
    from sympy import prime, nextprime
    def A138383(n):
        if n == 0: return 3
        q = nextprime(p:=prime(n))
        return (q-p)*(p+q+1)>>1 # Chai Wah Wu, Jun 01 2024

Formula

a(n) = (prime(n+1)-prime(n))*(prime(n+1)+prime(n)+1)/2 for n >= 1. - N. J. A. Sloane, May 08 2008