|
|
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.
|
|
1
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
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.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
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.
|
|
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 *)
|
|
PROG
|
(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.
(PARI) s(n) = sum(k=1, n, prime(k)); \\ A007504
f(n) = s(s(n)) - s(s(n-1)); \\ A034958
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|