OFFSET
1,2
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..8191
FORMULA
Sum_{k=1..n} (-1)^k * k * a(floor(n/k)) = -1.
G.f. A(x) satisfies -x = Sum_{k>=1} (-1)^k * k * (1 - x^k) * A(x^k).
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A361982(n):
if n <= 1:
return 1
c, j = 1, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += (((j2<<1)-1 if j2&1 else -(j2<<1)+1)+(-(j<<1)+1 if j&1 else (j<<1)-1)>>2)*A361982(k1)
j, k1 = j2, n//j2
return c+((-(n<<1)-1 if n&1 else (n<<1)+1)+(-(j<<1)+1 if j&1 else (j<<1)-1)>>2) # Chai Wah Wu, Apr 02 2023
CROSSREFS
KEYWORD
sign,look
AUTHOR
Seiichi Manyama, Apr 02 2023
STATUS
approved