%I #18 May 10 2023 04:31:19
%S 1,4,-5,23,-2,-29,-78,146,146,71,-50,-302,-471,-618,-393,1399,1110,
%T 1110,749,49,490,127,-402,-2418,-2418,-2925,-2925,-4297,-5138,-4463,
%U -5424,8912,10001,9134,10359,10359,8990,7907,9428,3828,2147,3470,1621,-1767,-1767,-3354,-5563
%N a(1) = 1; a(n) = Sum_{k=2..n} (-1)^k * k^2 * a(floor(n/k)).
%H Seiichi Manyama, <a href="/A361981/b361981.txt">Table of n, a(n) for n = 1..8191</a>
%F Sum_{k=1..n} (-1)^k * k^2 * a(floor(n/k)) = 0 for n > 1.
%F G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * k^2 * (1 - x^k) * A(x^k).
%t f[p_, e_] := If[e == 1, -p^2, 0]; f[2, e_] := If[e == 1, 3, 7*2^(3*e-4)]; 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 A361981(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*(j2-1) if j2&1 else -j2*(j2-1))+(-j*(j-1) if j&1 else j*(j-1))>>1)*A361981(k1)
%o j, k1 = j2, n//j2
%o return c+((-n*(n+1) if n&1 else n*(n+1))+(-j*(j-1) if j&1 else j*(j-1))>>1) # _Chai Wah Wu_, Apr 02 2023
%Y Partial sums of A361986.
%Y Cf. A309288, A359479.
%Y Cf. A360390, A361983.
%K sign,look
%O 1,2
%A _Seiichi Manyama_, Apr 02 2023
|