OFFSET
1,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..387
FORMULA
a(n) = Sum_{k=1..n} Sum_{d|k} (-n)^(d-1).
a(n) = [x^n] (1/(1 - x)) * Sum_{k>=1} x^k/(1 + n*x^k).
a(n) = [x^n] (1/(1 - x)) * Sum_{k>=1} (-n)^(k-1) * x^k/(1 - x^k).
a(n) ~ -(-1)^n * n^(n-1). - Vaclav Kotesovec, Jun 05 2021
MATHEMATICA
a[n_] := Sum[(-n)^(k - 1) * Quotient[n, k], {k, 1, n}]; Array[a, 20] (* Amiram Eldar, May 29 2021 *)
PROG
(PARI) a(n) = sum(k=1, n, n\k*(-n)^(k-1));
(PARI) a(n) = sum(k=1, n, sumdiv(k, d, (-n)^(d-1)));
(Magma)
A344820:= func< n | (&+[Floor(n/k)*(-n)^(k-1): k in [1..n]]) >;
[A344820(n): n in [1..40]]; // G. C. Greubel, Jun 26 2024
(SageMath)
def A344820(n): return sum((n//k)*(-n)^(k-1) for k in range(1, n+1))
[A344820(n) for n in range(1, 41)] # G. C. Greubel, Jun 26 2024
CROSSREFS
KEYWORD
sign
AUTHOR
Seiichi Manyama, May 29 2021
STATUS
approved