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-7 of 7 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)

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)

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

Original entry on oeis.org

3, 2, 11, 7, 5, 29, 23, 19, 17, 13, 59, 53, 47, 43, 41, 37, 31, 107, 103, 101, 97, 89, 83, 79, 73, 71, 67, 61, 179, 173, 167, 163, 157, 151, 149, 139, 137, 131, 127, 113, 109, 271, 269, 263, 257, 251, 241, 239, 233, 229, 227, 223, 211, 199, 197, 193, 191, 181
Offset: 1

Views

Author

Paolo Xausa, Jun 01 2021

Keywords

Comments

Irregular triangle read by rows in which row n lists the next p primes in decreasing order, where p is the n-th prime, with n >= 1.

Examples

			Written as an irregular triangle in which row lengths give A000040 the sequence begins:
    3,   2;
   11,   7,   5;
   29,  23,  19,  17,  13;
   59,  53,  47,  43,  41,  37,  31;
  107, 103, 101,  97,  89,  83,  79,  73,  71,  67,  61;
  179, 173, 167, 163, 157, 151, 149, 139, 137, 131, 127, 113, 109;
  ...
		

Crossrefs

Right border gives A180302.
Row lengths give A000040.
Row products give A119645.
Row sums give A034958.
Cf. A343809.

Programs

  • Mathematica
    Module[{nn=10,p},p=Total[Prime[Range[nn]]];Flatten[Reverse/@TakeList[ Prime[ Range[ p]],Prime[Range[nn]]]]] (* Harvey P. Dale, Sep 14 2022 *)

A320228 Distribute the primes into groups in ascending order, with the n-th group having prime(n) elements. Then a(n) is the sum of the numbers in the n-th group times the number of elements in the group.

Original entry on oeis.org

10, 69, 505, 2177, 10241, 24635, 65875, 120631, 244789, 531715, 802063, 1464941, 2279887, 3065943, 4444273, 6747695, 9882205, 12447843, 17304961, 22371177, 26991677, 35679165, 44240245, 56968633, 75590451, 91181689, 104420885, 124020811, 141249939, 164746655
Offset: 1

Views

Author

Keywords

Comments

On every step we sum prime(n) elements from the prime list and multiply the result by the number of elements of the sum.

Examples

			a(1) =   10 because "sum of next 2 primes times 2" is (2+3)*2;
a(2) =   69 because "sum of next 3 primes times 3" is (5+7+11)*3;
a(3) =  505 because "sum of next 5 primes times 5" is (13+17+19+23+29)*5;
a(4) = 2177 because "sum of next 7 primes times 7" is (31+37+41+43+47+53+59)*7.
		

Crossrefs

Programs

  • Mathematica
    With[{s = Prime@ Range[10^4]}, Rest@Nest[Append[#, {MapAt[Length[#] Total[#] &, TakeDrop[#[[-1, 1, 2]], Prime@ #[[-1, -1]]], 1], #[[-1, -1]] + 1}] &, {{{{}, s}, 1}}, 30]][[All, 1, 1]] (* Michael De Vlieger, Oct 15 2018 *)
  • PARI
    s(n) = sum(k=1, n, prime(k)); \\ A007504
    f(n) = s(s(n)) - s(s(n-1)); \\ A034958
    a(n) = prime(n)*f(n); \\ Michel Marcus, Oct 12 2018
  • PHP
    for ($n=1; $i<$maxTestedNumber; $n=$i+1){
        if(isPrime($n)){
            while ($amountOfPrimes < $n){
            if (isPrime($currNum)){
                $sumPrimes = $sumPrimes + $currNum;
                $amountOfPrimes++;
                }
            $currentNumber=$currentNumber+1;
            }
            $sumPrimesTimesN = $n*$sumPrimes;
            echo "$sumPrimesTimesN, ";
            $sumPrimes=0;      //Reset for next cycle
            $amountOfPrimes=0; //Reset for next cycle
        }
    //isPrime can be any function that returns TRUE if the tested number is prime and FALSE if the tested number is not prime.
    

Formula

a(n) = A000040(n)*A034958(n). - Michel Marcus, Oct 08 2018

A371877 Divide primes into groups with Fibonacci(n) elements and add together.

Original entry on oeis.org

2, 3, 12, 41, 139, 442, 1349, 4093, 12108, 35153, 101295, 289048, 819477, 2309689, 6472406, 18054351, 50153807, 138847614, 383282511, 1054875523, 2895955030, 7931352725, 21678032713, 59142462326, 161068803147, 437935857313, 1188967702870, 3223626641605, 8729120815845, 23609318259832
Offset: 1

Views

Author

Harish Chalwadi, May 24 2024

Keywords

Examples

			The primes and the groups of them summed begin
  primes 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ...
         \/ \/ \--/  \--------/  \----------------/
  F(n) =  1, 1,  2,      3,               5,      group length
  a(n) =  2, 3, 12,     41,             139,      group sum
a(1) = 2 because the first f(1)=1 prime is 2.
a(2) = 3 because the next f(2)=1 prime is 3.
a(3) = 12 because the next f(2)=2 primes are 5 and 7 which add up to 12.
a(4) = 41 because the next f(3)=3 primes are 11, 13 and 17, and they add up to 41.
		

Crossrefs

Programs

  • Mathematica
    With[{m = 30}, Plus @@@ TakeList[Prime[Range[Fibonacci[m + 2] - 1]], Fibonacci[Range[m]]]] (* Amiram Eldar, May 25 2024 *)
  • PARI
    a371877(nterms) = {my (n1=0, n2=1, p=1); for (n=1, nterms, n1=n2; n2=n1+fibonacci(n); my(s=0); for(k=n1, n2-1, s+=p=nextprime(p+1)); print1 (s, ", "))};
    a371877(30) \\ Hugo Pfoertner, May 25 2024

Extensions

a(11)-a(23) from Michel Marcus, May 25 2024
a(24)-a(30) from Hugo Pfoertner, May 25 2024
Showing 1-7 of 7 results.