[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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