login
A361981
a(1) = 1; a(n) = Sum_{k=2..n} (-1)^k * k^2 * a(floor(n/k)).
2
1, 4, -5, 23, -2, -29, -78, 146, 146, 71, -50, -302, -471, -618, -393, 1399, 1110, 1110, 749, 49, 490, 127, -402, -2418, -2418, -2925, -2925, -4297, -5138, -4463, -5424, 8912, 10001, 9134, 10359, 10359, 8990, 7907, 9428, 3828, 2147, 3470, 1621, -1767, -1767, -3354, -5563
OFFSET
1,2
LINKS
FORMULA
Sum_{k=1..n} (-1)^k * k^2 * a(floor(n/k)) = 0 for n > 1.
G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * k^2 * (1 - x^k) * A(x^k).
MATHEMATICA
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 *)
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A361981(n):
if n <= 1:
return 1
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += ((j2*(j2-1) if j2&1 else -j2*(j2-1))+(-j*(j-1) if j&1 else j*(j-1))>>1)*A361981(k1)
j, k1 = j2, n//j2
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
CROSSREFS
Partial sums of A361986.
Sequence in context: A176957 A341586 A010302 * A338422 A171885 A331261
KEYWORD
sign,look
AUTHOR
Seiichi Manyama, Apr 02 2023
STATUS
approved