login
A361982
a(n) = 1 + Sum_{k=2..n} (-1)^k * k * a(floor(n/k)).
5
1, 3, 0, 8, 3, -3, -10, 22, 22, 12, 1, -23, -36, -50, -35, 93, 76, 76, 57, 17, 38, 16, -7, -103, -103, -129, -129, -185, -214, -184, -215, 297, 330, 296, 331, 331, 294, 256, 295, 135, 94, 136, 93, 5, 5, -41, -88, -472, -472, -472, -421, -525, -578, -578, -523, -747, -690, -748
OFFSET
1,2
LINKS
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
Partial sums of A332793.
Cf. A068340.
Sequence in context: A200507 A348333 A296042 * A372827 A180661 A363053
KEYWORD
sign,look
AUTHOR
Seiichi Manyama, Apr 02 2023
STATUS
approved