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
Christian Efrain Maldonado Sifuentes, Table of n, a(n) for n = 1..297
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
a(n) = prime(n)*f(n); \\ Michel Marcus, Oct 12 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Christian Efrain Maldonado Sifuentes, Oct 07 2018
STATUS
approved