OFFSET
0,14
COMMENTS
This sequence is a signed variant of A022825.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
FORMULA
G.f. A(x) satisfies -x * (1 - x) = Sum_{k>=1} (-1)^k * (1 - x^k) * A(x^k). - Seiichi Manyama, Mar 31 2023
EXAMPLE
a(3) = a(floor(3/2)) - a(floor(3/3)) = a(1) - a(1) = 0.
MATHEMATICA
Join[{0}, Clear[a]; a[0]=0; a[1]=1; a[n_]:=a[n]=Sum[a[Floor[n/k]](-1)^k, {k, 2, n}]; Table[a[n], {n, 1, 100}]] (* Vincenzo Librandi, Jul 22 2019 *)
f[p_, e_] := If[e == 1, -1, 0]; f[2, e_] := If[e == 1, 0, 2^(e-2)]; s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Join[{0}, Accumulate[Array[s, 100]]] (* Amiram Eldar, May 09 2023 *)
PROG
(PARI) a(n) = if (n<=1, n, sum (k=2, n, (-1)^k * a(n\k)))
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A309288(n):
if n <= 1:
return n
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += ((j2-j)%2)*(1-2*(j%2))*A309288(k1)
j, k1 = j2, n//j2
return c+((n+1-j)%2)*(1-2*(j%2)) # Chai Wah Wu, Mar 31 2021
CROSSREFS
KEYWORD
sign,look
AUTHOR
Rémy Sigrist, Jul 21 2019
STATUS
approved