login
A344818
a(n) = Sum_{k=1..n} floor(n/k) * (-3)^(k-1).
11
1, -1, 9, -20, 62, -174, 556, -1660, 4911, -14693, 44357, -133053, 398389, -1195207, 3587853, -10763270, 32283452, -96850386, 290570104, -871710994, 2615074146, -7845220010, 23535839600, -70607518824, 211822017739, -635466060265, 1906399774635, -5719199303975
OFFSET
1,3
LINKS
FORMULA
a(n) = Sum_{k=1..n} Sum_{d|k} (-3)^(d-1).
G.f.: (1/(1 - x)) * Sum_{k>=1} x^k/(1 + 3*x^k).
G.f.: (1/(1 - x)) * Sum_{k>=1} (-3)^(k-1) * x^k/(1 - x^k).
a(n) ~ -(-1)^n * 3^n / 4. - Vaclav Kotesovec, Jun 05 2021
MATHEMATICA
a[n_] := Sum[(-3)^(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*(-3)^(k-1));
(PARI) a(n) = sum(k=1, n, sumdiv(k, d, (-3)^(d-1)));
(PARI) my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, x^k/(1+3*x^k))/(1-x))
(PARI) my(N=40, x='x+O('x^N)); Vec(sum(k=1, N, (-3)^(k-1)*x^k/(1-x^k))/(1-x))
(Magma)
A344818:= func< n | (&+[Floor(n/k)*(-3)^(k-1): k in [1..n]]) >;
[A344818(n): n in [1..40]]; // G. C. Greubel, Jun 26 2024
(SageMath)
def A344818(n): return sum((n//k)*(-3)^(k-1) for k in range(1, n+1))
[A344818(n) for n in range(1, 41)] # G. C. Greubel, Jun 26 2024
CROSSREFS
Column k=3 of A344824.
Cf. A101561.
Sums of the form Sum_{k=1..n} q^(k-1)*floor(n/k): A344820 (q=-n), A344819 (q=-4), this sequence (q=-3), A344817 (q=-2), A059851 (q=-1), A006218 (q=1), A268235 (q=2), A344814 (q=3), A344815 (q=4), A344816 (q=5), A332533 (q=n).
Sequence in context: A345727 A332372 A377002 * A341529 A013573 A146388
KEYWORD
sign
AUTHOR
Seiichi Manyama, May 29 2021
STATUS
approved