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.

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)

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