A369180 Alternating sum of the k-adic valuations (ruler functions) of n.
0, 1, -1, 3, -1, 1, -1, 5, -3, 1, -1, 4, -1, 1, -3, 8, -1, 0, -1, 4, -3, 1, -1, 7, -3, 1, -5, 4, -1, 1, -1, 10, -3, 1, -3, 5, -1, 1, -3, 7, -1, 1, -1, 4, -6, 1, -1, 11, -3, 0, -3, 4, -1, -1, -3, 7, -3, 1, -1, 6, -1, 1, -6, 14, -3, 1, -1, 4, -3, 1, -1, 9, -1, 1, -6, 4, -3, 1
Offset: 1
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..20000
Programs
-
Maple
a:= n-> add((-1)^i*padic[ordp](n, i), i=2..n): seq(a(n), n=1..78); # Alois P. Heinz, Jan 15 2024
-
Mathematica
z = 70; Sum[(-1)^k IntegerExponent[Range[z], k], {k, 2, z}]
-
PARI
a(n) = sum(k=2, n, (-1)^k * valuation(n,k)); \\ Michel Marcus, Jan 18 2024
-
PARI
a(n)=sumdiv(n,k, if(k>1, (-1)^k * valuation(n, k))) \\ Charles R Greathouse IV, Jan 23 2025