login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Sum of the semiprimes which are less than or equal to n minus the sum of the primes which are less than or equal to n.
0

%I #15 Jan 11 2025 19:21:52

%S 0,-2,-5,-1,-6,0,-7,-7,2,12,1,1,-12,2,17,17,0,0,-19,-19,2,24,1,1,26,

%T 52,52,52,23,23,-8,-8,25,59,94,94,57,95,134,134,93,93,50,50,50,96,49,

%U 49,98,98,149,149,96,96,151,151,208,266,207,207,146,208,208,208,273,273,206,206,275,275

%N Sum of the semiprimes which are less than or equal to n minus the sum of the primes which are less than or equal to n.

%C After a(32), a(n) always exceeds 0. See A243906(32).

%e a(6) = 0, because (4+6) - (2+3+5) = 0.

%t a[n_] := Plus @@ Select[ Range@ n, PrimeOmega@ # == 2 &] - Plus @@ Select[ Range@ n, PrimeOmega@ # == 1 &]; Array[a, 70]

%o (PARI) a(n) = my(vf=apply(factor, [1..n])); vecsum(Vec(select(x->(bigomega(x)==2), vf, 1))) - vecsum(Vec(select(x->(bigomega(x)==1), vf, 1))); \\ _Michel Marcus_, Dec 28 2024

%Y Cf. A001358, A062198, A000040, A007504, A243906.

%K sign

%O 1,2

%A _Robert G. Wilson v_ and Luca Bencini-Tibo, Dec 20 2024