A329393 Number of odd divisors minus number of even divisors of the n-th composite.
-1, 0, -2, 3, 0, -2, 0, 4, -3, 0, -2, 4, 0, -4, 3, 0, 4, -2, 0, -4, 4, 0, 4, -3, 0, 4, -4, 0, -2, 6, 0, -6, 3, 0, 4, -2, 0, 4, -4, 4, 0, -4, 0, 6, -5, 4, 0, -2, 4, 0, -6, 0, 6, -2, 4, 0, -6, 5, 0, -4, 4, 0, 4, -4, 0, 4, -2, 4, 0, 4, -8, 0, 6
Offset: 1
Keywords
Examples
a(1) = -1 since the first composite number is 4, which has 1 odd divisor (1), and 2 even divisors (2,4). a(2) = 0 since the second composite number is 6, which has 2 odd divisors (1,3) and 2 even divisors (2,6).
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..3000
Programs
-
Mathematica
f[p_, e_] := If[p == 2, 1 - e, 1 + e]; diffNum[1] = 1; diffNum[n_] := Times @@ (f @@@ FactorInteger[n]); diffNum /@ Select[Range[100], CompositeQ] (* Amiram Eldar, Nov 25 2019 *) odmed[n_]:=With[{divs=Divisors[n]},Count[divs,?OddQ]-Count[divs,?EvenQ]]; odmed/@Select[Range[100],CompositeQ] (* Harvey P. Dale, Nov 18 2024 *)
Comments