%I #49 Dec 09 2021 11:19:58
%S 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,
%T -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,
%U -4,1,0,3,-4,2,0,1,-1,2,-2,1,-4,1,0,3,-1,2,0,1,-5
%N a(n) = Sum_{d|n, d <= sqrt(n)} (-1)^(n/d + 1).
%H Michel Marcus, <a href="/A348515/b348515.txt">Table of n, a(n) for n = 1..10000</a>
%F G.f.: Sum_{k>=1} (-1)^(k + 1) * x^(k^2) / (1 + x^k).
%F a(n) = 1 iff n = 1 or n is an odd prime (A006005). - _Bernard Schott_, Nov 22 2021
%t Table[DivisorSum[n, (-1)^(n/# + 1) &, # <= Sqrt[n] &], {n, 1, 80}]
%t nmax = 80; CoefficientList[Series[Sum[(-1)^(k + 1) x^(k^2)/(1 + x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
%o (PARI) A348515(n) = sumdiv(n,d,if((d*d)<=n,(-1)^(1 + (n/d)),0)); \\ _Antti Karttunen_, Nov 05 2021
%o (Python)
%o from sympy import divisors
%o def a(n): return sum((-1)**(n//d + 1) for d in divisors(n) if d*d <= n)
%o print([a(n) for n in range(1, 81)]) # _Michael S. Branicky_, Nov 22 2021
%Y Cf. A038548, A048272, A113652, A228441, A305152, A333781, A348660, A348951, A348952.
%K sign
%O 1,4
%A _Ilya Gutkovskiy_, Nov 04 2021