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
{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.
-
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
-
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 *)
-
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
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
{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.
-
S:= n-> sum(ithprime(k), k=1..n): seq(S(n+1)^2-S(n)^2, n=0..40); # Gary Detlefs, Dec 20 2011
-
Accumulate[Join[{2}, ListConvolve[{1, 1}, #]]]*# & [Prime[Range[50]]] (* Paolo Xausa, Jun 23 2025 *)
-
a0(n) = vecsum(primes(n))^2 - vecsum(primes(n-1))^2; \\ Michel Marcus, Jun 16 2024
-
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
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
{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.
-
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
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
{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.
-
{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 *)
-
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
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
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;
...
-
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
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.
-
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 *)
-
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
-
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.
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
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.
-
With[{m = 30}, Plus @@@ TakeList[Prime[Range[Fibonacci[m + 2] - 1]], Fibonacci[Range[m]]]] (* Amiram Eldar, May 25 2024 *)
-
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
Showing 1-7 of 7 results.
Comments