Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Oct 16 2018 15:27:38
%S 10,69,505,2177,10241,24635,65875,120631,244789,531715,802063,1464941,
%T 2279887,3065943,4444273,6747695,9882205,12447843,17304961,22371177,
%U 26991677,35679165,44240245,56968633,75590451,91181689,104420885,124020811,141249939,164746655
%N 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.
%C On every step we sum prime(n) elements from the prime list and multiply the result by the number of elements of the sum.
%H Christian Efrain Maldonado Sifuentes, <a href="/A320228/b320228.txt">Table of n, a(n) for n = 1..297</a>
%F a(n) = A000040(n)*A034958(n). - _Michel Marcus_, Oct 08 2018
%e a(1) = 10 because "sum of next 2 primes times 2" is (2+3)*2;
%e a(2) = 69 because "sum of next 3 primes times 3" is (5+7+11)*3;
%e a(3) = 505 because "sum of next 5 primes times 5" is (13+17+19+23+29)*5;
%e a(4) = 2177 because "sum of next 7 primes times 7" is (31+37+41+43+47+53+59)*7.
%t 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 *)
%o (PHP)
%o for ($n=1; $i<$maxTestedNumber; $n=$i+1){
%o if(isPrime($n)){
%o while ($amountOfPrimes < $n){
%o if (isPrime($currNum)){
%o $sumPrimes = $sumPrimes + $currNum;
%o $amountOfPrimes++;
%o }
%o $currentNumber=$currentNumber+1;
%o }
%o $sumPrimesTimesN = $n*$sumPrimes;
%o echo "$sumPrimesTimesN, ";
%o $sumPrimes=0; //Reset for next cycle
%o $amountOfPrimes=0; //Reset for next cycle
%o }
%o //isPrime can be any function that returns TRUE if the tested number is prime and FALSE if the tested number is not prime.
%o (PARI) s(n) = sum(k=1, n, prime(k)); \\ A007504
%o f(n) = s(s(n)) - s(s(n-1)); \\ A034958
%o a(n) = prime(n)*f(n); \\ _Michel Marcus_, Oct 12 2018
%Y Cf. A000040, A007504, A034958.
%K nonn,easy
%O 1,1
%A _Christian Efrain Maldonado Sifuentes_, Oct 07 2018