OFFSET
1,3
LINKS
Robert Israel, Table of n, a(n) for n = 1..3319
FORMULA
a(n) = (-1)^(n+1) * [x^n]( Sum_{k>=1} x^k/(1+2*x^k) ).
a(p) = 2^(p-1) - 1, for p prime.
a(n) = (-1)^(n+1) * Sum_{d|n} (-2)^(d-1). - Robert Israel, Jun 04 2018
a(n) = (-1)^(n-1)*Sum_{k=1..n} (-1)^(k-1)*A128315(n, k). - G. C. Greubel, Jun 22 2024
MAPLE
f:= n -> (-1)^(n+1)*add((-2)^(d-1), d=numtheory:-divisors(n)):
map(f, [$1..100]); # Robert Israel, Jun 04 2018
MATHEMATICA
A081295[n_]:= (-1)^(n+1)*DivisorSum[n, (-2)^(#-1) &];
Table[A081295[n], {n, 40}] (* G. C. Greubel, Jun 22 2024 *)
PROG
(PARI) a(n) =if(n<1, 0, (-1)^(n+1)*polcoeff(sum(k=1, n, x^k/(1+2*x^k), x*O(x^n)), n))
(Magma)
A081295:= func< n | (-1)^(n+1)*(&+[(-2)^(d-1): d in Divisors(n)]) >;
[A081295(n): n in [1..40]]; // G. C. Greubel, Jun 22 2024
(SageMath)
def A081295(n): return (-1)^(n+1)*sum((-2)^(k-1) for k in (1..n) if (k).divides(n))
[A081295(n) for n in range(1, 41)] # G. C. Greubel, Jun 22 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 20 2003
STATUS
approved