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.

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.

This page as a plain text file.
%I A383641 #18 May 14 2025 21:44:46
%S A383641 0,0,0,4,4,10,10,18,9,19,19,31,31,45,30,46,46,64,64,84,63,85,85,109,
%T A383641 84,110,83,111,111,141,141,173,140,174,139,175,175,213,174,214,214,
%U A383641 256,256,300,255,301,301,349,300,350,299,351,351,405,350,406,349,407,407
%N 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.
%H A383641 Felix Huber, <a href="/A383641/b383641.txt">Table of n, a(n) for n = 1..10000</a>
%H A383641 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CompositeNumber.html">Composite Number</a>
%F A383641 a(n) = floor((n-2)/2) - n*(n mod 2) + Sum_{i=2..pi(n)} prime(i) for n > 1.
%F A383641 a(n) = A004526(n) - A193356(n) - A010701(n) + A034387(A000720(n)) for n > 1.
%F A383641 a(n) = Sum_{i=1..n} ((-1)^i*i*A066247(i)).
%e A383641 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.
%p A383641 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);
%t A383641 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 *)
%Y A383641 Cf. A000720, A002808, A004526, A010701, A028552, A034387, A066247, A071904, A101256, A193356, A262044, A383259.
%K A383641 nonn
%O A383641 1,4
%A A383641 _Felix Huber_, May 08 2025