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 11 results. Next

A152563 Primes in A152535.

Original entry on oeis.org

5, 11, 37, 61, 107, 181, 467, 563, 821, 947, 2341, 2939, 3833, 4073, 5479, 6043, 9161, 9281, 11399, 12323, 14249, 15263, 16007, 22027, 25117, 26249, 32189, 37987, 39581, 42139, 42853, 43093, 50291, 54449, 62653, 64063, 64919, 70181, 73189, 82219
Offset: 1

Views

Author

Omar E. Pol, Dec 07 2008

Keywords

Crossrefs

Programs

  • Maple
    A001223 := proc(n) ithprime(n+1)-ithprime(n) ; end: A141042 := proc(n) option remember ; n*A001223(n) ; end: A152535 := proc(n) add(A141042(i),i=1..n) ; end: for n from 1 to 300 do a35 := A152535(n) ; if isprime(a35) then printf("%d,",a35) ; fi; od: # R. J. Mathar, Feb 06 2009

Extensions

More terms from R. J. Mathar, Feb 06 2009

A007504 Sum of the first n primes.

Original entry on oeis.org

0, 2, 5, 10, 17, 28, 41, 58, 77, 100, 129, 160, 197, 238, 281, 328, 381, 440, 501, 568, 639, 712, 791, 874, 963, 1060, 1161, 1264, 1371, 1480, 1593, 1720, 1851, 1988, 2127, 2276, 2427, 2584, 2747, 2914, 3087, 3266, 3447, 3638, 3831, 4028, 4227, 4438, 4661, 4888
Offset: 0

Views

Author

Keywords

Comments

It appears that a(n)^2 - a(n-1)^2 = A034960(n). - Gary Detlefs, Dec 20 2011
This is true. Proof: By definition we have A034960(n) = Sum_{k = (a(n-1)+1)..a(n)} (2*k-1). Since Sum_{k = 1..n} (2*k-1) = n^2, it follows A034960(n) = a(n)^2 - a(n-1)^2, for n > 1. - Hieronymus Fischer, Sep 27 2012 [formulas above adjusted to changed offset of A034960 - Hieronymus Fischer, Oct 14 2012]
Row sums of the triangle in A037126. - Reinhard Zumkeller, Oct 01 2012
Ramanujan noticed the apparent identity between the prime parts partition numbers A000607 and the expansion of Sum_{k >= 0} x^a(k)/((1-x)...(1-x^k)), cf. A046676. See A192541 for the difference between the two. - M. F. Hasler, Mar 05 2014
For n > 0: row 1 in A254858. - Reinhard Zumkeller, Feb 08 2015
a(n) is the smallest number that can be partitioned into n distinct primes. - Alonso del Arte, May 30 2017
For a(n) < m < a(n+1), n > 0, at least one m is a perfect square.
Proof: For n = 1, 2, ..., 6, the proposition is clear. For n > 6, a(n) < ((prime(n) - 1)/2)^2, set (k - 1)^2 <= a(n) < k^2 < ((prime(n) + 1)/2)^2, then k^2 < (k - 1)^2 + prime(n) <= a(n) + prime(n) = a(n+1), so m = k^2 is this perfect square. - Jinyuan Wang, Oct 04 2018
For n >= 5 we have a(n) < ((prime(n)+1)/2)^2. This can be shown by noting that ((prime(n)+1)/2)^2 - ((prime(n-1)+1)/2)^2 - prime(n) = (prime(n)+prime(n-1))*(prime(n)-prime(n-1)-2)/4 >= 0. - Jianing Song, Nov 13 2022
Washington gives an oscillation formula for |a(n) - pi(n^2)|, see links. - Charles R Greathouse IV, Dec 07 2022

References

  • E. Bach and J. Shallit, §2.7 in Algorithmic Number Theory, Vol. 1: Efficient Algorithms, MIT Press, Cambridge, MA, 1996.
  • H. L. Nelson, "Prime Sums", J. Rec. Math., 14 (1981), 205-206.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A122989 for the value of Sum_{n >= 1} 1/a(n).

Programs

  • GAP
    P:=Filtered([1..250],IsPrime);;
    a:=Concatenation([0],List([1..Length(P)],i->Sum([1..i],k->P[k]))); # Muniru A Asiru, Oct 07 2018
    
  • Haskell
    a007504 n = a007504_list !! n
    a007504_list = scanl (+) 0 a000040_list
    -- Reinhard Zumkeller, Oct 01 2014, Oct 03 2011
    
  • Magma
    [0] cat [&+[ NthPrime(k): k in [1..n]]: n in [1..50]]; // Bruno Berselli, Apr 11 2011 (adapted by Vincenzo Librandi, Nov 27 2015 after Hasler's change on Mar 05 2014)
    
  • Maple
    s1:=[2]; for n from 2 to 1000 do s1:=[op(s1),s1[n-1]+ithprime(n)]; od: s1;
    A007504 := proc(n)
        add(ithprime(i), i=1..n) ;
    end proc: # R. J. Mathar, Sep 20 2015
  • Mathematica
    Accumulate[Prime[Range[100]]] (* Zak Seidov, Apr 10 2011 *)
    primeRunSum = 0; Table[primeRunSum = primeRunSum + Prime[k], {k, 100}] (* Zak Seidov, Apr 16 2011 *)
  • PARI
    A007504(n) = sum(k=1,n,prime(k)) \\ Michael B. Porter, Feb 26 2010
    
  • PARI
    a(n) = vecsum(primes(n)); \\ Michel Marcus, Feb 06 2021
    
  • Python
    from itertools import accumulate, count, islice
    from sympy import prime
    def A007504_gen(): return accumulate(prime(n) if n > 0 else 0 for n in count(0))
    A007504_list = list(islice(A007504_gen(),20)) # Chai Wah Wu, Feb 23 2022

Formula

a(n) ~ n^2 * log(n) / 2. - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 24 2001 (see Bach & Shallit 1996)
a(n) = A014284(n+1) - 1. - Jaroslav Krizek, Aug 19 2009
a(n+1) - a(n) = A000040(n+1). - Jaroslav Krizek, Aug 19 2009
a(A051838(n)) = A002110(A051838(n)) / A116536(n). - Reinhard Zumkeller, Oct 03 2011
a(n) = min(A068873(n), A073619(n)) for n > 1. - Jonathan Sondow, Jul 10 2012
a(n) = A033286(n) - A152535(n). - Omar E. Pol, Aug 09 2012
For n >= 3, a(n) >= (n-1)^2 * (log(n-1) - 1/2)/2 and a(n) <= n*(n+1)*(log(n) + log(log(n))+ 1)/2. Thus a(n) = n^2 * log(n) / 2 + O(n^2*log(log(n))). It is more precise than in Fares's comment. - Vladimir Shevelev, Aug 01 2013
a(n) = (n^2/2)*(log n + log log n - 3/2 + (log log n - 3)/log n + (2 (log log n)^2 - 14 log log n + 27)/(4 log^2 n) + O((log log n/log n)^3)) [Sinha]. - Charles R Greathouse IV, Jun 11 2015
G.f: (x*b(x))/(1-x), where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 10 2016
a(n) = A008472(A002110(n)), for n > 0. - Michel Marcus, Jul 16 2020

Extensions

More terms from Stefan Steinerberger, Apr 11 2006
a(0) = 0 prepended by M. F. Hasler, Mar 05 2014

A033286 a(n) = n * prime(n).

Original entry on oeis.org

2, 6, 15, 28, 55, 78, 119, 152, 207, 290, 341, 444, 533, 602, 705, 848, 1003, 1098, 1273, 1420, 1533, 1738, 1909, 2136, 2425, 2626, 2781, 2996, 3161, 3390, 3937, 4192, 4521, 4726, 5215, 5436, 5809, 6194, 6513, 6920, 7339, 7602, 8213, 8492, 8865, 9154, 9917
Offset: 1

Views

Author

Keywords

Comments

Does an n exist such that n*prime(n)/(n+prime(n)) is an integer? - Ctibor O. Zizka, Mar 04 2008. The answer to Zizka's question is easily seen to be No: such an integer k would be positive and less than prime(n), but then k*(n + prime(n)) = prime(n)*n would be impossible. - Robert Israel, Apr 20 2015
Sums of rows of the triangle in A005145. - Reinhard Zumkeller, Aug 05 2009
Complement of A171520(n). - Jaroslav Krizek, Dec 13 2009
Partial sums of A090942. - Omar E. Pol, Apr 20 2015

Crossrefs

Cf. A005145 (primes repeated), A171520 (complement), A076146 (iterated).

Programs

Formula

a(n) = n * A000040(n) = n * A008578(n+1) = n * A158611(n+2). - Jaroslav Krizek, Aug 31 2009
a(n) = A007504(n) + A152535(n). - Omar E. Pol, Aug 09 2012
Sum_{n>=1} 1/a(n) = A124012. - Amiram Eldar, Oct 15 2020

Extensions

Correction for change of offset in A158611 and A008578 in Aug 2009 from Jaroslav Krizek, Jan 27 2010

A141042 Product of n and the n-th gap between primes: a(n) = n*A001223(n).

Original entry on oeis.org

1, 4, 6, 16, 10, 24, 14, 32, 54, 20, 66, 48, 26, 56, 90, 96, 34, 108, 76, 40, 126, 88, 138, 192, 100, 52, 108, 56, 116, 420, 124, 192, 66, 340, 70, 216, 222, 152, 234, 240, 82, 420, 86, 176, 90, 552, 564, 192, 98, 200, 306, 104
Offset: 1

Views

Author

Omar E. Pol, Jul 30 2008

Keywords

Comments

a(n) is also the area under the curve of the function pi(x) from prime(n) to prime(n+1), see the illustration of initial terms. This sequence is also the first differences of A152535. - Omar E. Pol, Nov 13 2013

Examples

			a(5)=10 because the 5th prime is 11 and the 6th prime is 13. The 5th gap between primes is 2, then a(5)=5*2=10.
		

Crossrefs

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..1001)]:
    seq(n*(P[n+1]-P[n]),n=1..1000); # Robert Israel, Nov 26 2015
  • Mathematica
    Table[n*(Prime[n+1] - Prime[n]), {n, 100}] (* T. D. Noe, Nov 14 2013 *)
    With[{nn=60},Times@@@Thread[{Range[nn],Differences[Prime[Range[nn+1]]]}]] (* Harvey P. Dale, Dec 18 2018 *)
  • PARI
    diff(v)=vector(#v-1, i, (v[i+1]-v[i])*i);
    diff(primes(100)) \\ Altug Alkan, Nov 26 2015

Formula

a(n) = n*(A000040(n+1)-A000040(n)) = n*A001223(n).
a(n) = n*(1 + A046933(n)). [Omar E. Pol, Nov 16 2008]

Extensions

Corrected definition and example. - Omar E. Pol, Nov 16 2008
Name and example corrected by Bob Selcoe and Robert Israel, Nov 26 2015

A206817 Sum_{0

Original entry on oeis.org

1, 10, 73, 520, 3967, 33334, 309661, 3166468, 35416555, 430546642, 5655609529, 79856902816, 1206424711303, 19419937594990, 331860183278677, 6000534640290364, 114462875817046051, 2297294297649673738, 48394006967070653425
Offset: 2

Views

Author

Clark Kimberling, Feb 12 2012

Keywords

Comments

In the following guide to related sequences,
c(n) = Sum_{0
t(n) = Sum_{0
s(k).................c(n)........t(n)
k....................A000217.....A000292
k^2..................A016061.....A004320
k^3..................A206808.....A206809
k^4..................A206810.....A206811
k!...................A206816.....A206817
prime(k).............A152535.....A062020
prime(k+1)...........A185382.....A206803
2^(k-1)..............A000337.....A045618
k(k+1)/2.............A007290.....A034827
k-th quarter-square..A049774.....A206806

Examples

			a(3) = (2-1) + (6-1) + (6-2) = 10.
		

Crossrefs

Programs

  • Mathematica
    s[k_] := k!; t[1] = 0;
    p[n_] := Sum[s[k], {k, 1, n}];
    c[n_] := n*s[n] - p[n];
    t[n_] := t[n - 1] + (n - 1) s[n] - p[n - 1];
    Table[c[n], {n, 2, 32}]          (* A206816 *)
    Flatten[Table[t[n], {n, 2, 20}]] (* A206817 *)
  • PARI
    a(n)=sum(j=1,n,j!*(2*j-n-1)) \\ Charles R Greathouse IV, Oct 11 2015
    
  • PARI
    a(n)=my(t=1); sum(j=1,n,t*=j; t*(2*j-n-1)) \\ Charles R Greathouse IV, Oct 11 2015
  • Sage
    [sum([sum([factorial(k)-factorial(j) for j in range(1,k)]) for k in range(2,n+1)]) for n in range(2,21)] # Danny Rorabaugh, Apr 18 2015
    

Formula

a(n) = a(n-1)+(n-1)s(n)-p(n-1), where s(n) = n! and p(k) = 1!+2!+...+k!.
a(n) = Sum_{k=2..n} A206816(k).

A185382 Sum_{j=1..n-1} P(n)-P(j), where P(j) = A065091(j) is the j-th odd prime.

Original entry on oeis.org

0, 2, 6, 18, 26, 46, 58, 86, 134, 152, 212, 256, 280, 332, 416, 506, 538, 640, 712, 750, 870, 954, 1086, 1270, 1366, 1416, 1520, 1574, 1686, 2092, 2212, 2398, 2462, 2792, 2860, 3070, 3286, 3434, 3662, 3896, 3976, 4386, 4470, 4642, 4730, 5270
Offset: 1

Author

Clark Kimberling, Feb 13 2012

Keywords

Comments

It appears 1/3 of a(n) values are divisible by 3 (as measured up to n = 8000). Almost all of these cases occur consecutively (i.e., in "runs"). The sizes of these runs, including runs of 1, in the first 250 primes are given by this sequence: {2, 4, 1, 1, 2, 4, 2, 2, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 5, 6, 3, 2, 2, 3, 3, 9, 1, ..} with two runs up to 12 in length occurring in the first 5000 primes. - Richard R. Forberg, Mar 26 2015
a(n+1) == a(n) (mod 3) iff n == 0 (mod 3) or P(n+1) == P(n) (mod 3); this should have asymptotic probability 2/3, and explains some of the above comment. - Robert Israel, Mar 26 2015

Examples

			a(4)=(11-3)+(11-5)+(11-7)=18.
		

Crossrefs

Cf. A001223, A152535, A206802 (a(n)/2), A206803 (= partial sums of this), A206804, A206817.

Programs

  • Maple
    N:= 1000: # to get terms for all odd primes <= N
    P:= select(isprime,[seq(2*i+1, i=1..floor((N-1)/2))]):
    Q:= ListTools[PartialSums](P):
    seq(n*P[n]-Q[n],n=2..nops(P)); # Robert Israel, Mar 26 2015
  • Mathematica
    s[k_] := Prime[k + 1]; p[n_] := Sum[s[k], {k, 1, n}]; c[n_] := n*s[n] - p[n]; Table[c[n], {n, 2, 100}]
  • PARI
    A185382(n)=(n-1)*prime(n+1)-sum(k=2,n-1,prime(k)) \\ M. F. Hasler, May 02 2015

Formula

a(n) = (n-1)*A065091(n) - A071148(n-1) = (n-1)*prime(n+1) - sum_{1 < k <= n} prime(k). [Corrected and extended by M. F. Hasler, May 02 2015]
a(n) = A206803(n) - A206803(n-1).
a(n) = Sum_{j=1..n-1} j*A001223(j+1). - Robert Israel, Mar 26 2015

Extensions

Edited and a(1)=0 prefixed by M. F. Hasler, May 02 2015

A230850 A054541 and A000012 interleaved.

Original entry on oeis.org

2, 1, 1, 1, 2, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 6, 1, 2, 1, 6, 1, 4, 1, 2, 1, 4, 1, 6, 1, 6, 1, 2, 1, 6, 1, 4, 1, 2, 1, 6, 1, 4, 1, 6, 1, 8, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 14, 1, 4, 1, 6, 1, 2, 1, 10, 1, 2, 1, 6, 1, 6, 1, 4, 1, 6, 1, 6, 1, 2, 1, 10, 1, 2, 1
Offset: 1

Author

Omar E. Pol, Oct 31 2013

Keywords

Comments

a(n) is also the length of the n-th edge of a staircase which represents the function pi(x) on the first quadrant of the square grid, see A000720.
a(2n-1) is the length of the n-th horizontal edge in the staircase.
a(2n) is the length of the n-th vertical edge in the staircase.
For another version see A230849.

Examples

			Illustration of initial terms, n = 1..22:
.
1                                                              _ _|
1                                                  _ _ _ _ _ _|
1                                          _ _ _ _|
1                                      _ _|
1                              _ _ _ _|
1                          _ _|
1                  _ _ _ _|
1              _ _|
1          _ _|
1        _|
1    _ _|
.
.      2 1   2   2       4   2       4   2       4           6   2
.
Drawing vertical line segments below the staircase (as shown below) we have that the number of cells in the vertical bars gives 0 together A000720.
Drawing horizontal line segments above the staircase we have that the number of cells in the k-th horizontal bar is A000040(k).
.    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
31  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
29  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | |
23  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | |
19  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | |
17  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | |
13  |_ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | |
11  |_ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | |
7   |_ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | |
5   |_ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | |
3   |_ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
2   |_ _|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
.
.    0 0 1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 10 10
.
		

Programs

  • Mathematica
    Riffle[Join[{2},Differences[Prime[Range[100]]]],1] (* Paolo Xausa, Oct 31 2023 *)
  • PARI
    A230850(n) = if(1==n,2,if((n%2),prime((n+1)/2)-prime(((n+1)/2)-1),1)); \\ Antti Karttunen, Dec 23 2018

Formula

a(1) = 2; for n > 1, a(n) = A230849(n). - Antti Karttunen, Dec 23 2018

A090942 n-th arithmetic mean = prime(n).

Original entry on oeis.org

2, 4, 9, 13, 27, 23, 41, 33, 55, 83, 51, 103, 89, 69, 103, 143, 155, 95, 175, 147, 113, 205, 171, 227, 289, 201, 155, 215, 165, 229, 547, 255, 329, 205, 489, 221, 373, 385, 319, 407, 419, 263, 611, 279, 373, 289, 763, 787, 419, 327, 433, 545, 345, 781, 581, 593
Offset: 1

Author

Amarnath Murthy, Dec 29 2003

Keywords

Comments

Partial sums give A033286. - Omar E. Pol, Apr 20 2015
In other words, this is the unique sequence such that for all n >= 1, (1/n) * Sum_{k=1..n} a(k) = prime(n). - Antti Karttunen, Apr 30 2015

Examples

			From _Omar E. Pol_, Apr 20 2015: (Start)
Illustration of initial terms:
Consider a diagram in the first quadrant of the square grid in which the length of the n-th horizontal line segment is equal to the n-th prime, as shown below:
.   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  51|
.  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          83|   |
.  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _      55|           |   |
.  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  33|       |           |   |
.  |_ _ _ _ _ _ _ _ _ _ _ _ _      41|   |       |           |   |
.  |_ _ _ _ _ _ _ _ _ _ _  23|       |   |       |           |   |
.  |_ _ _ _ _ _ _      27|   |       |   |       |           |   |
.  |_ _ _ _ _  13|       |   |       |   |       |           |   |
.  |_ _ _   9|   |       |   |       |   |       |           |   |
.  |_ _ 4|   |   |       |   |       |   |       |           |   |
.  |_2_|_|_ _|_ _|_ _ _ _|_ _|_ _ _ _|_ _|_ _ _ _|_ _ _ _ _ _|_ _|
.
a(n) is also the area (or the number of cells) in the n-th region of the diagram. For example: a(4) = 7 + 6 = 13.
(End)
		

Programs

  • Magma
    [n le 1 select 2 else n*NthPrime(n) - (n-1)*NthPrime(n-1): n in [1..60]]; // G. C. Greubel, Feb 04 2019
    
  • Mathematica
    Table[If[n==1, 2, nPrime@n -(n-1)Prime[n-1]], {n, 60}] (* Michael De Vlieger, Apr 20 2015 *)
  • PARI
    vector(60, n, if(n==1,2, n*prime(n) -(n-1)*prime(n-1))) \\ G. C. Greubel, Feb 04 2019
    
  • Sage
    [2] + [n*nth_prime(n) - (n-1)*nth_prime(n-1) for n in (2..60)] # G. C. Greubel, Feb 04 2019

Formula

a(n) = n*prime(n) - (n-1)*prime(n-1).
a(n) = A033287(n-2), n>1. - R. J. Mathar, Sep 08 2008
a(n) = A000040(n) + A141042(n-1), n >=2. - Omar E. Pol, Apr 20 2015

Extensions

Corrected and extended by Ray Chandler, Dec 31 2003

A230849 A075526 and A000012 interleaved.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 6, 1, 2, 1, 6, 1, 4, 1, 2, 1, 4, 1, 6, 1, 6, 1, 2, 1, 6, 1, 4, 1, 2, 1, 6, 1, 4, 1, 6, 1, 8, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 14, 1, 4, 1, 6, 1, 2, 1, 10, 1, 2, 1, 6, 1, 6, 1, 4, 1, 6, 1, 6, 1, 2, 1, 10, 1, 2, 1
Offset: 1

Author

Omar E. Pol, Nov 01 2013

Keywords

Comments

a(n) is also the length of the n-th edge of a staircase which represents the function pi(x) on the first quadrant of the square grid, see A000720.
a(2n-1) is the length of the n-th horizontal edge in the staircase.
a(2n) is the length of the n-th vertical edge in the staircase.
For another version see A230850.

Examples

			Illustration of initial terms, n = 1..22:
.
1                                                            _ _|
1                                                _ _ _ _ _ _|
1                                        _ _ _ _|
1                                    _ _|
1                            _ _ _ _|
1                        _ _|
1                _ _ _ _|
1            _ _|
1        _ _|
1      _|
1    _|
.
.    1 1   2   2       4   2       4   2       4           6   2
.
Drawing vertical line segments below the staircase (as shown below) we have that the number of cells in the vertical bars gives A000720.
Drawing horizontal line segments above the staircase we have that the number of cells in the k-th horizontal bar is A006093(k).
.    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
30  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
28  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | |
22  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | |
18  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | |
16  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | |
12  |_ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | |
10  |_ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | |
6   |_ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | |
4   |_ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | |
2   |_ _| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
1   |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
.
.    0 1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 10 10
.
		

Programs

  • Mathematica
    Riffle[Join[{1},Differences[Prime[Range[100]]]],1] (* Paolo Xausa, Oct 31 2023 *)
  • PARI
    A230849(n) = if((n%2)&&(n>1),prime((n+1)/2)-prime(((n+1)/2)-1),1); \\ Antti Karttunen, Dec 23 2018

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

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.
Showing 1-10 of 11 results. Next