%I #27 May 10 2023 04:30:57
%S 1,2,-1,5,0,-3,-10,14,14,9,-2,-20,-33,-40,-25,71,54,54,35,5,26,15,-8,
%T -80,-80,-93,-93,-135,-164,-149,-180,204,237,220,255,255,218,199,238,
%U 118,77,98,55,-11,-11,-34,-81,-369,-369,-369,-318,-396,-449,-449,-394,-562,-505,-534
%N a(1) = 1; a(n) = Sum_{k=2..n} (-1)^k * k * a(floor(n/k)).
%H Seiichi Manyama, <a href="/A359479/b359479.txt">Table of n, a(n) for n = 1..8191</a>
%F Sum_{k=1..n} (-1)^k * k * a(floor(n/k)) = 0 for n > 1.
%F G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * k * (1 - x^k) * A(x^k).
%t f[p_, e_] := If[e == 1, -p, 0]; f[2, e_] := If[e == 1, 1, 6*4^(e-2)]; s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Accumulate[Array[s, 100]] (* _Amiram Eldar_, May 09 2023 *)
%o (Python)
%o from functools import lru_cache
%o @lru_cache(maxsize=None)
%o def A359479(n):
%o if n <= 1:
%o return 1
%o c, j = 0, 2
%o k1 = n//j
%o while k1 > 1:
%o j2 = n//k1 + 1
%o c += ((j2>>1 if j2&1 else -(j2>>1))-(j>>1 if j&1 else -(j>>1)))*A359479(k1)
%o j, k1 = j2, n//j2
%o return c+(-(n+1>>1) if n&1 else n+1>>1)+(-(j>>1) if j&1 else j>>1) # _Chai Wah Wu_, Mar 31 2023
%Y Cf. A309288.
%K sign,look
%O 1,2
%A _Seiichi Manyama_, Mar 31 2023
|