login
A348515
a(n) = Sum_{d|n, d <= sqrt(n)} (-1)^(n/d + 1).
3
1, -1, 1, -2, 1, 0, 1, -2, 2, 0, 1, -3, 1, 0, 2, -3, 1, -1, 1, -1, 2, 0, 1, -4, 2, 0, 2, -1, 1, -2, 1, -3, 2, 0, 2, -3, 1, 0, 2, -4, 1, 0, 1, -1, 3, 0, 1, -5, 2, -1, 2, -1, 1, 0, 2, -4, 2, 0, 1, -4, 1, 0, 3, -4, 2, 0, 1, -1, 2, -2, 1, -4, 1, 0, 3, -1, 2, 0, 1, -5
OFFSET
1,4
LINKS
FORMULA
G.f.: Sum_{k>=1} (-1)^(k + 1) * x^(k^2) / (1 + x^k).
a(n) = 1 iff n = 1 or n is an odd prime (A006005). - Bernard Schott, Nov 22 2021
MATHEMATICA
Table[DivisorSum[n, (-1)^(n/# + 1) &, # <= Sqrt[n] &], {n, 1, 80}]
nmax = 80; CoefficientList[Series[Sum[(-1)^(k + 1) x^(k^2)/(1 + x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
PROG
(PARI) A348515(n) = sumdiv(n, d, if((d*d)<=n, (-1)^(1 + (n/d)), 0)); \\ Antti Karttunen, Nov 05 2021
(Python)
from sympy import divisors
def a(n): return sum((-1)**(n//d + 1) for d in divisors(n) if d*d <= n)
print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Nov 22 2021
KEYWORD
sign
AUTHOR
Ilya Gutkovskiy, Nov 04 2021
STATUS
approved