A378764 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, -2, -5, -1, -6, 0, -7, -7, 2, 12, 1, 1, -12, 2, 17, 17, 0, 0, -19, -19, 2, 24, 1, 1, 26, 52, 52, 52, 23, 23, -8, -8, 25, 59, 94, 94, 57, 95, 134, 134, 93, 93, 50, 50, 50, 96, 49, 49, 98, 98, 149, 149, 96, 96, 151, 151, 208, 266, 207, 207, 146, 208, 208, 208, 273, 273, 206, 206, 275, 275
Offset: 1
Keywords
Examples
a(6) = 0, because (4+6) - (2+3+5) = 0.
Programs
-
Mathematica
a[n_] := Plus @@ Select[ Range@ n, PrimeOmega@ # == 2 &] - Plus @@ Select[ Range@ n, PrimeOmega@ # == 1 &]; Array[a, 70]
-
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
Comments