login
A344819
a(n) = Sum_{k=1..n} floor(n/k) * (-4)^(k-1).
11
1, -2, 15, -52, 205, -806, 3291, -13160, 52393, -209498, 839079, -3356300, 13420917, -53683854, 214751875, -859006400, 3435960897, -13743843762, 54975632975, -219902535924, 879609095965, -3518436366566, 14073749677851, -56294998711576, 225179977999337, -900719912066074
OFFSET
1,2
LINKS
FORMULA
a(n) = Sum_{k=1..n} Sum_{d|k} (-4)^(d-1).
G.f.: (1/(1 - x)) * Sum_{k>=1} x^k/(1 + 4*x^k).
G.f.: (1/(1 - x)) * Sum_{k>=1} (-4)^(k-1) * x^k/(1 - x^k).
a(n) ~ -(-1)^n * 4^n / 5. - Vaclav Kotesovec, Jun 05 2021
MATHEMATICA
a[n_] := Sum[(-4)^(k - 1) * Quotient[n, k], {k, 1, n}]; Array[a, 30] (* Amiram Eldar, May 29 2021 *)
PROG
(PARI) a(n) = sum(k=1, n, n\k*(-4)^(k-1));
(PARI) a(n) = sum(k=1, n, sumdiv(k, d, (-4)^(d-1)));
(PARI) my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, x^k/(1+4*x^k))/(1-x))
(PARI) my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, (-4)^(k-1)*x^k/(1-x^k))/(1-x))
(Magma)
A344819:= func< n | (&+[(-4)^(k-1)*Floor(n/k): k in [1..n]]) >;
[A344819(n): n in [1..40]]; // G. C. Greubel, Jun 25 2024
(SageMath)
def A344819(n): return sum((-4)^(k-1)*int(n//k) for k in range(1, n+1))
[A344819(n) for n in range(1, 41)] # G. C. Greubel, Jun 25 2024
CROSSREFS
KEYWORD
sign
AUTHOR
Seiichi Manyama, May 29 2021
STATUS
approved