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.

Showing 1-1 of 1 results.

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.

Original entry on oeis.org

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

Views

Author

Felix Huber, May 08 2025

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.
		

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 *)

Formula

a(n) = floor((n-2)/2) - n*(n mod 2) + Sum_{i=2..pi(n)} prime(i) for n > 1.
a(n) = A004526(n) - A193356(n) - A010701(n) + A034387(A000720(n)) for n > 1.
a(n) = Sum_{i=1..n} ((-1)^i*i*A066247(i)).
Showing 1-1 of 1 results.