|
|
A359479
|
|
a(1) = 1; a(n) = Sum_{k=2..n} (-1)^k * k * a(floor(n/k)).
|
|
4
|
|
|
1, 2, -1, 5, 0, -3, -10, 14, 14, 9, -2, -20, -33, -40, -25, 71, 54, 54, 35, 5, 26, 15, -8, -80, -80, -93, -93, -135, -164, -149, -180, 204, 237, 220, 255, 255, 218, 199, 238, 118, 77, 98, 55, -11, -11, -34, -81, -369, -369, -369, -318, -396, -449, -449, -394, -562, -505, -534
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
FORMULA
|
Sum_{k=1..n} (-1)^k * k * a(floor(n/k)) = 0 for n > 1.
G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * k * (1 - x^k) * A(x^k).
|
|
MATHEMATICA
|
f[p_, e_] := If[e == 1, -p, 0]; f[2, e_] := If[e == 1, 1, 6*4^(e-2)]; 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)
if n <= 1:
return 1
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += ((j2>>1 if j2&1 else -(j2>>1))-(j>>1 if j&1 else -(j>>1)))*A359479(k1)
j, k1 = j2, n//j2
return c+(-(n+1>>1) if n&1 else n+1>>1)+(-(j>>1) if j&1 else j>>1) # Chai Wah Wu, Mar 31 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|