A383641 a(n) is the difference between the sum of even composites and the sum of the odd composites in the first n positive integers.
0, 0, 0, 4, 4, 10, 10, 18, 9, 19, 19, 31, 31, 45, 30, 46, 46, 64, 64, 84, 63, 85, 85, 109, 84, 110, 83, 111, 111, 141, 141, 173, 140, 174, 139, 175, 175, 213, 174, 214, 214, 256, 256, 300, 255, 301, 301, 349, 300, 350, 299, 351, 351, 405, 350, 406, 349, 407, 407
Offset: 1
Keywords
Examples
Of the first 9 positive integers, 4, 6, and 8 are even composites and 9 is an odd composite, so a(9) = 4 + 6 + 8 - 9 = 9.
Links
- Felix Huber, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Composite Number
Crossrefs
Programs
-
Maple
A383641:=n->`if`(n=1,0,floor((n-2)/2)-n*(n mod 2)+add(ithprime(i),i=2..NumberTheory:-pi(n)));seq(A383641(n),n=1..59);
-
Mathematica
lim=59;cn=Select[Range[lim],CompositeQ];a[n_]:=Total[Select[cn,EvenQ[#]&<=n&]]-Total[Select[cn,OddQ[#]&<=n&]];Array[a,lim] (* James C. McMahon, May 14 2025 *)