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

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)

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

Original entry on oeis.org

1, 9, 35, 91, 242, 442, 833, 1273, 2024, 3306, 4464, 6586, 8897, 11137, 14288, 18762, 24190, 28670, 35778, 42813, 49275, 59329, 69056, 81702, 98067, 112110, 124836, 140919, 155325, 173568, 210312, 233835, 262903, 285923, 327949, 355001, 393285
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1998

Keywords

Comments

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

Examples

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

Crossrefs

Programs

  • Mathematica
    {1}~Join~Map[Abs@ Apply[Subtract, Map[PolygonalNumber, #]] &, Partition[Accumulate@ Prime@ Range@ 37 - 1, 2, 1]] (* Michael De Vlieger, Oct 06 2019 *)
    Module[{nn=40,tprs},tprs=Total[Prime[Range[nn]]];Total/@TakeList[Range[0,tprs],Prime[Range[nn]]]] (* Harvey P. Dale, Apr 18 2025 *)
  • Python
    from itertools import islice
    from sympy import nextprime
    def A034957_gen(): # generator of terms
        a, p = 0, 2
        while True:
            yield p*((a<<1)+p-1)>>1
            a, p = a+p, nextprime(p)
    A034957_list = list(islice(A034957_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-1), n > 1.
a(n) = (A007504(n) - A007504(n-1))*(A007504(n) + A007504(n-1) - 1)/2, n > 1.
a(n) = (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) = A034959(n)/2.
a(n) = A034956(n) - A000040(n).
(End)

A343809 Divide the positive integers into subsets of lengths given by successive primes, then reverse the order of terms in each subset.

Original entry on oeis.org

2, 1, 5, 4, 3, 10, 9, 8, 7, 6, 17, 16, 15, 14, 13, 12, 11, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59
Offset: 1

Views

Author

Paolo Xausa, Apr 30 2021

Keywords

Comments

From Omar E. Pol, Apr 30 2021: (Start)
Irregular triangle read by rows T(n,k) in which row n lists the next p positive integers in decreasing order, where p is the n-th prime, with n >= 1.
The triangle has the following properties:
Column 1 gives the nonzero terms of A007504.
Column 2 gives A237589.
Column 3 gives A071148.
Column 4 gives the terms > 2 of A343859.
Column 5 gives the absolute values of the terms < -1 of A282329.
Column 6 gives the terms > 7 of A082548.
Column 7 gives the terms > 6 of A115030.
Records are in the column 1.
Indices of records are in the right border.
Right border gives A014284.
Row lengths give A000040.
Row products give A078423.
Row sums give A034956. (End)

Examples

			From _Omar E. Pol_, Apr 30 2021: (Start)
Written as an irregular triangle in which row lengths give A000040 the sequence begins:
   2,  1;
   5,  4,  3;
  10,  9,  8,  7,  6;
  17, 16, 15, 14, 13, 12, 11;
  28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18;
  41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29;
  58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42;
  77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59;
  ...
(End)
		

Crossrefs

Programs

  • Maple
    R:= NULL: t:= 1:
    for i from 1 to 20 do
      p:= ithprime(i);
      R:= R, seq(i,i=t+p-1..t,-1);
      t:= t+p;
    od:
    R; # Robert Israel, Apr 30 2021
  • Mathematica
    With[{nn=10},Reverse/@TakeList[Range[Total[Prime[Range[nn]]]],Prime[Range[nn]]]]//Flatten (* Harvey P. Dale, Apr 27 2022 *)

Formula

T(n,k) = A007504(n) - k + 1, with n >= 1 and 1 <= k <= A000040(n). - Omar E. Pol, May 01 2021

A073612 Group the positive integers as (1, 2), (3, 4, 5), (6, 7, 8, 9, 10), (11, 12, 13, 14, 15, 16, 17), ... the n-th group containing prime(n) elements. Except the first, all groups contain an odd number of elements and hence have a middle term. Sequence gives the middle terms starting from group 2.

Original entry on oeis.org

4, 8, 14, 23, 35, 50, 68, 89, 115, 145, 179, 218, 260, 305, 355, 411, 471, 535, 604, 676, 752, 833, 919, 1012, 1111, 1213, 1318, 1426, 1537, 1657, 1786, 1920, 2058, 2202, 2352, 2506, 2666, 2831, 3001, 3177, 3357, 3543, 3735, 3930, 4128, 4333, 4550, 4775
Offset: 2

Views

Author

Amarnath Murthy, Aug 05 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Table[ Sum[ Prime[i], {i, 1, n}] - Floor[ Prime[n]/2], {n, 2, 50}]
    For[lst={}; n1=3; n=2, n<=100, n++, n2=n1+Prime[n]; AppendTo[lst, (n2+n1-1)/2]; n1=n2]; lst
    Module[{nn=50,no,pr},no=Total[Prime[Range[2,nn+1]]];pr=Prime[Range[2,nn]]; #[[ (Length[ #]+1)/2]]&/@TakeList[Range[3,no],pr]] (* Requires Mathematica version 11 or later *) (* Harvey P. Dale, Sep 20 2017 *)

Formula

Difference of the triangular numbers corresponding to the sum of first (n+1) primes and that of first n primes/prime(n) for n > 1.
a(n) = (A061802(n-1) + 1)/2. - Hugo Pfoertner, Apr 30 2021
a(n) = A007504(n) - (prime(n)-1)/2. - Andrew Howroyd, Apr 30 2021
a(n) = (Sum_{i=2..n-1} A001043(i)) / 2 + 4. - Christian Krause, May 06 2021

Extensions

Edited by Robert G. Wilson v and T. D. Noe, Aug 08 2002

A344718 Divide the positive integers into subsets of lengths given by successive primes. a(n) is the sum of primes contained in the n-th subset.

Original entry on oeis.org

2, 8, 7, 41, 42, 138, 143, 331, 348, 660, 864, 1444, 1322, 2349, 1824, 3195, 4122, 4696, 4264, 7184, 8038, 8259, 9988, 10972, 15151, 15446, 16954, 18322, 19994, 26001, 27985, 28426, 32541, 38963, 41797, 51790, 40074, 64140, 59403, 60066, 63732, 66980, 99172, 82152
Offset: 1

Views

Author

Paolo Xausa, May 27 2021

Keywords

Examples

			a(1) = 2 because the first subset is [1,2] (length = 2) and the sum of primes contained in it is 2.
a(2) = 8 because the second subset is [3,4,5] (length = 3) and the sum of primes contained in it is 3 + 5 = 8.
a(3) = 7 because the third subset is [6,7,8,9,10] (length = 5) and the sum of primes contained in it is 7.
a(4) = 41 because the fourth subset is [11,12,13,14,15,16,17] (length = 7) and the sum of primes contained in it is 11 + 13 + 17 = 41.
		

Crossrefs

Programs

  • Mathematica
    nterms=50;list = TakeList[Range[Sum[Prime[i],{i,nterms}]],Prime[Range[nterms]]];Map[Total[Select[#,PrimeQ]]&,list]

A078423 Group the natural numbers into clumps with increasing prime numbers of elements, then multiply the members of each clump.

Original entry on oeis.org

2, 60, 30240, 98017920, 857180548224000, 109720581991308288000, 70265584374661732509573120000, 61765285634580106110458762035200000, 642817384174195049892129048242945261568000000
Offset: 1

Views

Author

Lior Manor, Dec 29 2002

Keywords

Examples

			Dividing 1,2,3,4,5,6,7,8,9,10,... into clumps of 2,3,5,.. elements: {1,2}, {3,4,5}, {6,7,8,9,10}, ... and then multiply each clumps to get 2,60,30240,...
		

Crossrefs

Formula

a(n) = A007504(n)!/A007504(n-1)!. - Andrew Howroyd, Oct 16 2023
Showing 1-8 of 8 results.