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.

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.

This page as a plain text file.
%I A320228 #31 Oct 16 2018 15:27:38
%S A320228 10,69,505,2177,10241,24635,65875,120631,244789,531715,802063,1464941,
%T A320228 2279887,3065943,4444273,6747695,9882205,12447843,17304961,22371177,
%U A320228 26991677,35679165,44240245,56968633,75590451,91181689,104420885,124020811,141249939,164746655
%N 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.
%C A320228 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 A320228 Christian Efrain Maldonado Sifuentes, <a href="/A320228/b320228.txt">Table of n, a(n) for n = 1..297</a>
%F A320228 a(n) = A000040(n)*A034958(n). - _Michel Marcus_, Oct 08 2018
%e A320228 a(1) =   10 because "sum of next 2 primes times 2" is (2+3)*2;
%e A320228 a(2) =   69 because "sum of next 3 primes times 3" is (5+7+11)*3;
%e A320228 a(3) =  505 because "sum of next 5 primes times 5" is (13+17+19+23+29)*5;
%e A320228 a(4) = 2177 because "sum of next 7 primes times 7" is (31+37+41+43+47+53+59)*7.
%t A320228 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 A320228 (PHP)
%o A320228 for ($n=1; $i<$maxTestedNumber; $n=$i+1){
%o A320228     if(isPrime($n)){
%o A320228         while ($amountOfPrimes < $n){
%o A320228         if (isPrime($currNum)){
%o A320228             $sumPrimes = $sumPrimes + $currNum;
%o A320228             $amountOfPrimes++;
%o A320228             }
%o A320228         $currentNumber=$currentNumber+1;
%o A320228         }
%o A320228         $sumPrimesTimesN = $n*$sumPrimes;
%o A320228         echo "$sumPrimesTimesN, ";
%o A320228         $sumPrimes=0;      //Reset for next cycle
%o A320228         $amountOfPrimes=0; //Reset for next cycle
%o A320228     }
%o A320228 //isPrime can be any function that returns TRUE if the tested number is prime and FALSE if the tested number is not prime.
%o A320228 (PARI) s(n) = sum(k=1, n, prime(k)); \\ A007504
%o A320228 f(n) = s(s(n)) - s(s(n-1)); \\ A034958
%o A320228 a(n) = prime(n)*f(n); \\ _Michel Marcus_, Oct 12 2018
%Y A320228 Cf. A000040, A007504, A034958.
%K A320228 nonn,easy
%O A320228 1,1
%A A320228 _Christian Efrain Maldonado Sifuentes_, Oct 07 2018