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

A073164 Quotients arising in A073162: A046992(n)/n if n is in A073162.

Original entry on oeis.org

0, 1, 4, 7, 604, 7552, 28720, 43501, 176868, 3016559
Offset: 1

Views

Author

Labos Elemer, Jul 18 2002

Keywords

Examples

			Sum of first 17 values of Pi(n) equals: 0+1+2+2+3+3+4+4+4+4+5+5+6+6+6+6+7 = 68 = 4*17, Sum(17)/17 = 4 = a(3).
		

Crossrefs

Programs

  • Mathematica
    s = 0; Do[s = s + PrimePi[n]; If[ IntegerQ[s/n], Print[{n, s, s/n}]], {n, 1, 10^8}]

Formula

Integer values of s(n)=A046992(n)/n.

Extensions

Edited and extended by Robert G. Wilson v, Jul 20 2002
a(10) from Donovan Johnson, Dec 15 2009

A122516 Primes in A046992.

Original entry on oeis.org

3, 5, 11, 19, 23, 37, 43, 61, 83, 107, 181, 271, 283, 349, 467, 499, 547, 563, 743, 821, 863, 947, 991, 1013, 1571, 2341, 2437, 2633, 2803, 2837, 2939, 3299, 3373, 3677, 3833, 4073, 4793, 4973, 5387, 5479, 5573, 6043, 6091, 6737, 7907, 8017, 8693, 8867
Offset: 1

Views

Author

Roger L. Bagula, Sep 16 2006

Keywords

Comments

A subset of A057447. - Alexander Adamchuk, Sep 17 2006

Crossrefs

Programs

  • Haskell
    a122516 n = a122516_list !! (n-1)
    a122516_list = filter ((== 1) . a010051) a046992_list
    -- Reinhard Zumkeller, Feb 25 2012
  • Mathematica
    Flatten[Table[If[PrimeQ[Sum[ PrimePi[n], {n, 1, m}]], Sum[PrimePi[n], {n, 1, m}], {}], {m, 1, 200}]]

Formula

a(n) = Prime[ A122933[n] ]. - Alexander Adamchuk, Sep 20 2006

Extensions

Edited by N. J. A. Sloane, Sep 17 2006
More terms from Alexander Adamchuk, Sep 17 2006
Definition corrected, Sep 30 2006

A122515 a(n) = A007504(n) - A046992(n).

Original entry on oeis.org

2, 4, 7, 12, 20, 30, 43, 58, 77, 102, 128, 160, 195, 232, 273, 320, 372, 426, 485, 548, 613, 684, 758, 838, 926, 1018, 1112, 1210, 1309, 1412, 1528, 1648, 1774, 1902, 2040, 2180, 2325, 2476, 2631, 2792, 2958, 3126, 3303, 3482, 3665, 3850, 4046, 4254, 4466
Offset: 1

Views

Author

Roger L. Bagula, Sep 16 2006

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Sum[Prime[n], {n, 1, m}] - Sum[PrimePi[n], {n, 1, m}], {m, 1, 50}]
  • Python
    from sympy import prime, primerange
    def A122515(n): return -(n+1)*len(p:=list(primerange(n+1)))+(sum(p)<<1)+sum(primerange(n+1,prime(n)+1)) # Chai Wah Wu, Jan 01 2024

Extensions

Edited by N. J. A. Sloane, Sep 17 2006

A034387 Sum of primes <= n.

Original entry on oeis.org

0, 2, 5, 5, 10, 10, 17, 17, 17, 17, 28, 28, 41, 41, 41, 41, 58, 58, 77, 77, 77, 77, 100, 100, 100, 100, 100, 100, 129, 129, 160, 160, 160, 160, 160, 160, 197, 197, 197, 197, 238, 238, 281, 281, 281, 281, 328, 328, 328, 328, 328, 328, 381, 381, 381, 381, 381
Offset: 1

Views

Author

Keywords

Comments

Also sum of all prime factors in n!.
For large n, these numbers can be closely approximated by the number of primes < n^2. For example, the sum of primes < 10^10 = 2220822432581729238. The number of primes < (10^10)^2 or 10^20 = 2220819602560918840. This has a relative error of 0.0000012743... - Cino Hilliard, Jun 08 2008
Equals row sums of triangle A143537. - Gary W. Adamson, Aug 23 2008
Partial sums of A061397. - Reinhard Zumkeller, Mar 21 2014

Crossrefs

This is a lower bound on A287881.

Programs

  • Haskell
    a034387 n = a034387_list !! (n-1)
    a034387_list = scanl1 (+) a061397_list
    -- Reinhard Zumkeller, Mar 21 2014
    
  • Maple
    a:= proc(n) option remember; `if`(n<1, 0,
          a(n-1)+`if`(isprime(n), n, 0))
        end:
    seq(a(n), n=1..60);  # Alois P. Heinz, Jun 29 2022
  • Mathematica
    s=0; Table[s=s+n*Boole[PrimeQ[n]],{n,100}] (* Zak Seidov, Apr 11 2011 *)
    Accumulate[Table[If[PrimeQ[n],n,0],{n,60}]] (* Harvey P. Dale, Jul 25 2016 *)
  • PARI
    a(n)=sum(i=1,primepi(n),prime(i)) \\ Michael B. Porter, Sep 22 2009
    
  • PARI
    a=0;for(k=1,100,print1(a=a+k*isprime(k),", ")) \\ Zak Seidov, Apr 11 2011
    
  • PARI
    a(n) = if(n <= 1, return(0)); my(r=sqrtint(n)); my(V=vector(r, k, n\k)); my(L=n\r-1); V=concat(V, vector(L, k, L-k+1)); my(T=vector(#V, k, V[k]*(V[k]+1)\2)); my(S=Map(matrix(#V,2,x,y,if(y==1,V[x],T[x])))); forprime(p=2, r, my(sp=mapget(S,p-1), p2=p*p); for(k=1, #V, if(V[k] < p2, break); mapput(S, V[k], mapget(S,V[k]) - p*(mapget(S,V[k]\p) - sp)))); mapget(S,n)-1; \\ Daniel Suteu, Jun 29 2022
    
  • Python
    from sympy import isprime
    from itertools import accumulate
    def alist(n): return list(accumulate(k*isprime(k) for k in range(1, n+1)))
    print(alist(57)) # Michael S. Branicky, Sep 18 2021

Formula

From the prime number theorem a(n) has the asymptotic expression: a(n) ~ n^2 / (2 log n). - Dan Fux (dan.fux(AT)OpenGaia.com), Apr 07 2001
a(n) = A158662(n) - 1. a(p) - a(p-1) = p, for p = primes (A000040), a(c) - a(c-1) = 0, for c = composite numbers (A002808). - Jaroslav Krizek, Mar 23 2009
a(n) = n^2/(2 log n) + O(n^2 log log n/log^2 n). - Vladimir Shevelev and Charles R Greathouse IV, May 29 2014
Conjecture: G.f.: Sum_{i>0} Sum_{j>=i} Sum_{k>=j|i-j+k is prime} x^k. - Benedict W. J. Irwin, Mar 31 2017
a(n) = (n+1)*A000720(n) - A046992(n). - Ridouane Oudra, Sep 18 2021
a(n) = A007504(A000720(n)). - Ridouane Oudra, Feb 22 2022
a(n) = Sum_{p<=n, p prime} p. - Wesley Ivan Hurt, Dec 31 2023

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

A034956 Divide natural numbers in groups with prime(n) elements and add together.

Original entry on oeis.org

3, 12, 40, 98, 253, 455, 850, 1292, 2047, 3335, 4495, 6623, 8938, 11180, 14335, 18815, 24249, 28731, 35845, 42884, 49348, 59408, 69139, 81791, 98164, 112211, 124939, 141026, 155434, 173681, 210439, 233966, 263040, 286062, 328098, 355152, 393442, 434558, 472777
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

Natural numbers starting from 1,2,3,4,...

Examples

			{1,2} #2 S=3;
{3,4,5} #3 S=12;
{6,7,8,9,10} #5 S=40;
{11,12,13,14,15,16,17} #7 S=98.
		

Crossrefs

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n<1, 0, s(n-1)+ithprime(n)) end:
    a:= n-> (t-> t(s(n))-t(s(n-1)))(i-> i*(i+1)/2):
    seq(a(n), n=1..40);  # Alois P. Heinz, Mar 22 2023
  • Mathematica
    Module[{nn=50,pr},pr=Prime[Range[nn]];Total/@TakeList[Range[ Total[ pr]], pr]](* Requires Mathematica version 11 or later *) (* Harvey P. Dale, Oct 01 2017 *)
  • Python
    from itertools import islice
    from sympy import nextprime
    def A034956_gen(): # generator of terms
        a, p = 0, 2
        while True:
            yield p*((a<<1)+p+1)>>1
            a, p = a+p, nextprime(p)
    A034956_list = list(islice(A034956_gen(),20)) # Chai Wah Wu, Mar 22 2023

Formula

From Hieronymus Fischer, Sep 27 2012: (Start)
a(n) = Sum_{k=A007504(n-1)+1..A007504(n)} k, n > 1.
a(n) = (A007504(n) - A007504(n-1))*(A007504(n) + A007504(n-1) + 1)/2, n > 1.
a(n) = (A000217(A007504(n)) - A000217(A007504(n-1))), n > 0.
If we define A007504(0) := 0, then the formulas above are also true for n=1.
a(n) = (A034960(n) + A000040(n))/2.
a(n) = A034957(n) + A000040(n). (End)

A034958 Divide primes into groups with prime(n) elements and add together.

Original entry on oeis.org

5, 23, 101, 311, 931, 1895, 3875, 6349, 10643, 18335, 25873, 39593, 55607, 71301, 94559, 127315, 167495, 204063, 258283, 315087, 369749, 451635, 533015, 640097, 779283, 902789, 1013795, 1159073, 1295871, 1457935, 1786691, 2002645, 2272221
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Examples

			a(1) = 5 because the first 2 primes are 2 and 3 and 2 + 3 = 5.
a(2) = 23 because the next 3 primes are 5, 7, 11, and they add up to 23.
a(3) = 101 because the next 5 primes are 13, 17, 19, 23, 29 which add up to 101.
a(4) = 311 because the next 7 primes are 31, 37, 41, 43, 47, 53, 59 and they add up to 311.
		

Crossrefs

Programs

  • Mathematica
    Join[{5},Total[Prime[Range[#[[1]]+1,#[[2]]]]]&/@Partition[ Accumulate[ Prime[ Range[40]]],2,1]] (* Harvey P. Dale, Oct 03 2013 *)
    Module[{nn=33},Total/@TakeList[Prime[Range[Total[Prime[Range[nn]]]]], Prime[ Range[ nn]]]] (* Requires Mathematica version 11 or later *) (* Harvey P. Dale, Mar 16 2018 *)
    s = 0; Total[Table[s = s + 1; Prime[s], {j, 33}, {n, Prime[j]}], {2}] (* Horst H. Manninger, Jan 17 2019 *)
  • PARI
    s(n) = sum(k=1, n, prime(k)); \\ A007504
    a(n) = s(s(n)) - s(s(n-1)); \\ Michel Marcus, Oct 12 2018

Formula

From Hieronymus Fischer, Sep 26 2012: (Start)
a(n) = Sum_{k=A007504(n-1)+1..A007504(n)} A000040(k), n > 1.
a(n) = A007504(A007504(n)) - A007504(A007504(n-1)), n > 1.
If we define A007504(0) := 0, then the formulas are also true for n = 1.
(End)

A034960 Divide odd numbers into groups with prime(n) elements and add together.

Original entry on oeis.org

4, 21, 75, 189, 495, 897, 1683, 2565, 4071, 6641, 8959, 13209, 17835, 22317, 28623, 37577, 48439, 57401, 71623, 85697, 98623, 118737, 138195, 163493, 196231, 224321, 249775, 281945, 310759, 347249, 420751, 467801, 525943, 571985, 656047
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Examples

			{1,3} #2 S=4;
{5,7,9} #3 S=21;
{11,13,15,17,19} #5 S=75;
{21,23,25,27,29,31,33} #7 S=189.
		

Crossrefs

Programs

  • Maple
    S:= n-> sum(ithprime(k), k=1..n): seq(S(n+1)^2-S(n)^2, n=0..40); # Gary Detlefs, Dec 20 2011
  • Mathematica
    Accumulate[Join[{2}, ListConvolve[{1, 1}, #]]]*# & [Prime[Range[50]]] (* Paolo Xausa, Jun 23 2025 *)
  • PARI
    a0(n) = vecsum(primes(n))^2 - vecsum(primes(n-1))^2; \\ Michel Marcus, Jun 16 2024
  • Python
    from itertools import islice
    from sympy import nextprime
    def A034960_gen(): # generator of terms
        a, p = 0, 2
        while True:
            yield p*((a<<1)+p)
            a, p = a+p, nextprime(p)
    A034960_list = list(islice(A034960_gen(),20)) # Chai Wah Wu, Mar 22 2023
    

Formula

From Hieronymus Fischer, Sep 26 2012: (Start)
a(n) = Sum_{k=A007504(n-1)+1..A007504(n)} (2*k-1).
a(n) = A007504(n)^2 - A007504(n-1)^2.
a(n) = 2*A034957(n) + A000040(n).
a(n) = 2*A034956(n) - A000040(n).
a(n) = A034959(n) + A000040(n). (End)
a(n) = A061802(n)*A000040(n). - Marco Zárate, May 12 2023

A034959 Divide even numbers into groups with prime(n) elements and add together.

Original entry on oeis.org

2, 18, 70, 182, 484, 884, 1666, 2546, 4048, 6612, 8928, 13172, 17794, 22274, 28576, 37524, 48380, 57340, 71556, 85626, 98550, 118658, 138112, 163404, 196134, 224220, 249672, 281838, 310650, 347136, 420624, 467670, 525806, 571846, 655898
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Examples

			{0,2} #2 S=2;
{4,6,8} #3 S=18;
{10,12,14,16,18} #5 S=70;
{20,22,24,26,28,30,32} #7 S=182.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import nextprime
    def A034959_gen(): # generator of terms
        a, p = 0, 2
        while True:
            yield p*((a<<1)+p-1)
            a, p = a+p, nextprime(p)
    A034959_list = list(islice(A034959_gen(),20)) # Chai Wah Wu, Mar 22 2023

Formula

From Hieronymus Fischer, Sep 27 2012: (Start)
a(n) = 2*Sum_{k=(A007504(n-1)+1)..A007504(n)} (k-1), n > 1.
a(n) = (A007504(n) - A007504(n-1))*(A007504(n) + A007504(n-1) - 1), n > 1.
a(n) = 2*(A000217(A007504(n) - 1) - A000217(A007504(n-1) - 1)), n > 1.
If we define A007504(0):=0, then the formulas above are also true for n=1.
a(n) = 2*A034957(n).
a(n) = A034960(n) - A000040(n).
(End)

A368610 a(n) = Sum_{k=1..n} pi(k) * ceiling(n/k).

Original entry on oeis.org

0, 1, 4, 8, 14, 20, 30, 38, 49, 59, 72, 82, 101, 113, 130, 147, 167, 181, 206, 222, 248, 270, 293, 311, 346, 367, 392, 416, 448, 468, 508, 530, 565, 594, 624, 653, 700, 724, 757, 789, 836, 862, 913, 941, 985, 1028, 1067, 1097, 1159, 1193, 1240, 1279, 1328, 1360, 1418
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 31 2023

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Sum[PrimePi[k] Ceiling[n/k], {k, n}], {n, 100}]

Formula

a(n) = A092494(n) + A368612(n).
Showing 1-10 of 29 results. Next