A195017 If n = Product_{k >= 1} (p_k)^(c_k) where p_k is k-th prime and c_k >= 0 then a(n) = Sum_{k >= 1} c_k*((-1)^(k-1)).
0, 1, -1, 2, 1, 0, -1, 3, -2, 2, 1, 1, -1, 0, 0, 4, 1, -1, -1, 3, -2, 2, 1, 2, 2, 0, -3, 1, -1, 1, 1, 5, 0, 2, 0, 0, -1, 0, -2, 4, 1, -1, -1, 3, -1, 2, 1, 3, -2, 3, 0, 1, -1, -2, 2, 2, -2, 0, 1, 2, -1, 2, -3, 6, 0, 1, 1, 3, 0, 1, -1, 1, 1, 0, 1, 1, 0, -1, -1, 5, -4, 2, 1, 0, 2, 0, -2, 4, -1, 0, -2, 3, 0, 2, 0, 4, 1, -1, -1, 4, -1, 1, 1, 2, -1
Offset: 1
Examples
The sequence can be read from a list of the polynomials: p(n,x) with x = -1, gives a(n) ------------------------------------------ p(1,x) = 0 0 p(2,x) = 1x^0 1 p(3,x) = x -1 p(4,x) = 2x^0 2 p(5,x) = x^2 1 p(6,x) = 1+x 0 p(7,x) = x^3 -1 p(8,x) = 3x^0 3 p(9,x) = 2x -2 p(10,x) = x^2 + 1 2. (The list runs through all the polynomials whose coefficients are nonnegative integers.)
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Crossrefs
Programs
-
Mathematica
b[n_] := Table[x^k, {k, 0, n}]; f[n_] := f[n] = FactorInteger[n]; z = 200; t[n_, m_, k_] := If[PrimeQ[f[n][[m, 1]]] && f[n][[m, 1]] == Prime[k], f[n][[m, 2]], 0]; u = Table[Apply[Plus, Table[Table[t[n, m, k], {k, 1, PrimePi[n]}], {m, 1, Length[f[n]]}]], {n, 1, z}]; p[n_, x_] := u[[n]].b[-1 + Length[u[[n]]]] Table[p[n, x] /. x -> 0, {n, 1, z/2}] (* A007814 *) Table[p[2 n, x] /. x -> 0, {n, 1, z/2}] (* A001511 *) Table[p[n, x] /. x -> 1, {n, 1, z}] (* A001222 *) Table[p[n, x] /. x -> 2, {n, 1, z}] (* A048675 *) Table[p[n, x] /. x -> 3, {n, 1, z}] (* A090880 *) Table[p[n, x] /. x -> -1, {n, 1, z}] (* A195017 *) z = 100; Sum[-(-1)^k IntegerExponent[Range[z], Prime[k]], {k, 1, PrimePi[z]}] (* Friedjof Tellkamp, Aug 05 2024 *)
-
PARI
A195017(n) = { my(f); if(1==n, 0, f=factor(n); sum(i=1, #f~, f[i,2] * (-1)^(1+primepi(f[i,1])))); } \\ Antti Karttunen, Oct 03 2018
Formula
Totally additive with a(p^e) = e * (-1)^(1+PrimePi(p)), where PrimePi(n) = A000720(n). - Antti Karttunen, Oct 03 2018
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{p prime} = (-1)^(primepi(p)+1)/(p-1) = Sum_{k>=1} (-1)^(k+1)/A006093(k) = A078437 + Sum_{k>=1} (-1)^(k+1)/A036689(k) = 0.6339266524059... . - Amiram Eldar, Sep 29 2023
a(n) = -Sum_{k=1..pi(n)} (-1)^k * valuation(n, prime(k)). - Friedjof Tellkamp, Aug 05 2024
Extensions
More terms, name changed and example-section edited by Antti Karttunen, Oct 03 2018
Comments