A328967 a(n+1) = 1 - Sum_{k=1..n} a(floor(n/k)).
1, 0, 0, -1, 0, -2, 0, -3, 1, -4, 0, -5, 3, -6, 1, -8, 5, -9, 3, -10, 8, -13, 4, -14, 15, -16, 7, -21, 15, -22, 14, -23, 27, -28, 14, -32, 32, -33, 20, -42, 41, -43, 32, -44, 50, -57, 33, -58, 71, -61, 46, -75, 70, -76, 59, -82, 98, -95, 62, -96, 117, -97, 81, -122, 131
Offset: 1
Keywords
Programs
-
Mathematica
a[n_] := a[n] = 1 - Sum[a[Floor[(n - 1)/k]], {k, 1, n - 1}]; Table[a[n], {n, 1, 65}] A281487[1] = 1; A281487[n_] := A281487[n] = -Sum[A281487[d], {d, Divisors[n - 1]}]; Table[A281487[n], {n, 1, 65}] // Accumulate
-
Python
from functools import lru_cache @lru_cache(maxsize=None) def A328967(n): if n == 0: return 1 c, j = n-1, 1 k1 = (n-1)//j while k1 > 1: j2 = (n-1)//k1 + 1 c += (j2-j)*A328967(k1) j, k1 = j2, (n-1)//j2 return j-c # Chai Wah Wu, Mar 31 2021
Formula
G.f. A(x) satisfies: A(x) = (x/(1 - x)) * (1 - Sum_{k>=1} (1 - x^k) * A(x^k)).