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.

A189892 a(n) = n*prime(n) - sum_{i=1..n-1} prime(i).

Original entry on oeis.org

2, 4, 10, 18, 38, 50, 78, 94, 130, 190, 212, 284, 336, 364, 424, 520, 622, 658, 772, 852, 894, 1026, 1118, 1262, 1462, 1566, 1620, 1732, 1790, 1910, 2344, 2472, 2670, 2738, 3088, 3160, 3382, 3610, 3766, 4006, 4252, 4336, 4766, 4854, 5034, 5126, 5690
Offset: 1

Views

Author

Bruno Berselli, Apr 30 2011

Keywords

Examples

			a(4) = 4*prime(4) - (prime(3) + prime(2) + prime(1)) = 4*7 - (5 + 3 + 2) = 18.
		

Crossrefs

Programs

  • Magma
    [2] cat [n*NthPrime(n)-(&+[NthPrime(k): k in [1..n-1]]): n in [2..47]];
    
  • Mathematica
    nn=50;Join[{2},With[{prs=Accumulate[Prime[Range[nn]]]},Table[n*Prime[n]-prs[[n-1]],{n,2,nn}]]] (* Harvey P. Dale, Nov 21 2014 *)
  • PARI
    v=vector(10000);s=n=i=0;forprime(p=2,1e9,v[i++]=n++*p-s;if(i==#v,return,s+=p)) \\ Charles R Greathouse IV, May 01 2011

Formula

a(n) = A033286(n+1) - A007504(n) for n>1.