login
For each prime p take the sum of nonprimes < p.
0

%I #11 Sep 28 2013 03:16:31

%S 1,1,5,11,38,50,95,113,176,306,336,506,623,665,800,1050,1330,1390,

%T 1710,1917,1989,2369,2612,3042,3693,3990,4092,4407,4515,4848,6408,

%U 6795,7465,7603,8899,9049,9819,10619,11114,11964,12844,13024,14698,14890,15475

%N For each prime p take the sum of nonprimes < p.

%C Subsequence of A101203. - _Michel Marcus_, Sep 28 2013

%e For p=7 we get 1+4+6=11.

%t nn=200;With[{np=Complement[Range[nn],Prime[Range[PrimePi[nn]]]]}, Table[ Total[Select[np,#<p&]],{p,Prime[Range[PrimePi[nn]]]}]] (* _Harvey P. Dale_, Jun 25 2013 *)

%o (PARI) a(n) = {my(p = prime(n)); sum (i=1, p-1, i*(! isprime(i)));} \\ _Michel Marcus_, Sep 28 2013

%o (PARI) a(n)=my(p=prime(n),s=1); forcomposite(k=4,p,s+=k);k \\ _Charles R Greathouse IV_, Sep 28 2013

%Y Cf. A000040.

%K nonn,easy

%O 1,3

%A _Felice Russo_

%E Corrected and extended by _Erich Friedman_.