login
Running sums of consecutive integers with all primes set to 2.
0

%I #6 Nov 21 2013 12:48:46

%S 0,1,3,5,9,11,17,19,27,36,46,48,60,62,76,91,107,109,127,129,149,170,

%T 192,194,218,243,269,296,324,326,356,358,390,423,457,492,528,530,568,

%U 607,647,649,691,693,737,782,828,830,878,927,977,1028,1080,1082,1136,1191

%N Running sums of consecutive integers with all primes set to 2.

%C a(n) is the running sum of the set integers where all primes are even.

%e n Sum Action Reason

%e -- ---- ------- --------------

%e 0 0 add 0 0 is not prime

%e 1 1 add 1 1 is not prime

%e 2 3 add 2 2 is prime

%e 3 5 add 2 3 is prime

%e 4 9 add 4 4 is not prime

%p g(n,m) = s=0;for(x=0,n,if(isprime(x),s+=m,s+=x);print1(s","))

%t Accumulate[If[PrimeQ[#],2,#]&/@Range[0,60]] (* _Harvey P. Dale_, Feb 15 2012 *)

%K easy,nonn

%O 0,3

%A _Cino Hilliard_, Feb 04 2006