login
A361983
a(n) = 1 + Sum_{k=2..n} (-1)^k * k^2 * a(floor(n/k)).
5
1, 5, -4, 28, 3, -33, -82, 174, 174, 74, -47, -335, -504, -700, -475, 1573, 1284, 1284, 923, 123, 564, 80, -449, -2753, -2753, -3429, -3429, -4997, -5838, -4938, -5899, 10485, 11574, 10418, 11643, 11643, 10274, 8830, 10351, 3951, 2270, 4034, 2185, -1687, -1687, -3803
OFFSET
1,2
LINKS
FORMULA
Sum_{k=1..n} (-1)^k * k^2 * a(floor(n/k)) = -1.
G.f. A(x) satisfies -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_] := 2^(3*e - 1); 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 A361983(n):
if n <= 1:
return 1
c, j = 1, 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)*A361983(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 A361987.
Cf. A336276.
Sequence in context: A277058 A275960 A024067 * A192778 A051138 A157101
KEYWORD
sign,look
AUTHOR
Seiichi Manyama, Apr 02 2023
STATUS
approved