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

A152535 a(n) = n*prime(n) - Sum_{i=1..n} prime(i).

Original entry on oeis.org

0, 1, 5, 11, 27, 37, 61, 75, 107, 161, 181, 247, 295, 321, 377, 467, 563, 597, 705, 781, 821, 947, 1035, 1173, 1365, 1465, 1517, 1625, 1681, 1797, 2217, 2341, 2533, 2599, 2939, 3009, 3225, 3447, 3599, 3833, 4073, 4155, 4575, 4661
Offset: 1

Views

Author

Omar E. Pol, Dec 06 2008

Keywords

Comments

a(n) is also the area under the curve of the function pi(x) from 0 to prime(n). - Omar E. Pol, Nov 13 2013

Examples

			From _Omar E. Pol_, Apr 27 2015: (Start)
For n = 5 the 5th prime is 11 and the sum of first five primes is 2 + 3 + 5 + 7 + 11 = 28, so a(5) = 5*11 - 28 = 27.
Illustration of a(5) = 27:
Consider a diagram in the first quadrant of the square grid in which the number of cells in the n-th horizontal bar is equal to the n-th prime, as shown below:
.      _ _ _ _ _ _ _ _ _ _ _
. 11  |_ _ _ _ _ _ _ _ _ _ _|
.  7  |_ _ _ _ _ _ _|* * * *
.  5  |_ _ _ _ _|* * * * * *
.  3  |_ _ _|* * * * * * * *
.  2  |_ _|* * * * * * * * *
.
a(5) is also the area (or the number of cells, or the number of *'s) under the bar's structure of prime numbers: a(5) = 1 + 4 + 6 + 16 = 27.
(End)
		

Crossrefs

Programs

  • Mathematica
    nn = 100; p = Prime[Range[nn]]; Range[nn] p - Accumulate[p] (* T. D. Noe, May 02 2011 *)
  • PARI
    vector(80, n, n*prime(n) - sum(k=1, n, prime(k))) \\ Michel Marcus, Apr 20 2015
    
  • Python
    from sympy import prime, primerange
    def A152535(n): return (n-1)*(p:=prime(n))-sum(primerange(p)) # Chai Wah Wu, Jan 01 2024
  • Sage
    [n*nth_prime(n) - sum(nth_prime(j) for j in range(1,n+1)) for n in range(1,45)] # Danny Rorabaugh, Apr 18 2015
    

Formula

a(n) = A033286(n) - A007504(n). - Omar E. Pol, Aug 09 2012
a(n) = A046992(A006093(n)). - Omar E. Pol, Apr 21 2015
a(n+1) = Sum_{k=A000124(n-1)..A000217(n)} A204890(k). - Benedict W. J. Irwin, May 23 2016
a(n) = Sum_{k=1..n-1} k*A001223(k). - François Huppé, Mar 16 2022

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

Views

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
.
		

Crossrefs

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

A230980 Number of primes <= n, starting at n=0.

Original entry on oeis.org

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, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 21, 21
Offset: 0

Views

Author

Omar E. Pol, Nov 02 2013

Keywords

Comments

Essentially identical to A000720, except that sequence, being an arithmetical sequence, starts at n = 1. - N. J. A. Sloane, Jun 21 2017
Also, on the first quadrant of the square grid, consider a diagram in which the number of cells in the horizontal bar of the k-th row is equal to the k-th prime, see example. The total length of the boundary segments between the structure formed by the first k horizontal bars and the structure formed by the vertical bars, from [0, 0], is equal to A014688(k). a(n) is the number of cells in the vertical bar of the n-th column.
Note that in a similar diagram for A000720 the lengths of the horizontal bars give A006093 (primes minus 1) not A000040 (the prime numbers) because A000720 has only one zero, not two.
Also, the number of distinct prime factors of the factorial number n!. - Torlach Rush, Jan 17 2014
The lengths of the boundary horizontal segments between the structure formed by the horizontal bars and the structure formed by the vertical bars of the diagram gives A054541. The zig-zag path formed by the boundary segments is in A230850. - Omar E. Pol, Jun 22 2017

Examples

			Illustration of initial terms:
.     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
31   |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
29   |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | |
23   |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | |
19   |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | |
17   |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | |
13   |_ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | |
11   |_ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | |
7    |_ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | |
5    |_ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | |
3    |_ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
2    |_ _|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
.
n:    0 1 2 3 4 5 6 7 8 9...
a(n): 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
		

Crossrefs

Programs

Extensions

Offset and definition changed by N. J. A. Sloane, Jun 21 2017
Showing 1-3 of 3 results.