A317843 Dirichlet inverse of Stern's diatomic sequence (A002487).
1, -1, -2, 0, -3, 2, -3, 0, 0, 3, -5, 0, -5, 3, 8, 0, -5, 0, -7, 0, 4, 5, -7, 0, 2, 5, 0, 0, -7, -8, -5, 0, 14, 5, 9, 0, -11, 7, 10, 0, -11, -4, -13, 0, -8, 7, -9, 0, 0, -2, 8, 0, -13, 0, 19, 0, 18, 7, -11, 0, -9, 5, 14, 0, 23, -14, -11, 0, 14, -9, -13, 0, -15, 11, -20, 0, 13, -10, -13, 0, 2, 11, -19, 0, 9, 13, 10, 0, -17, 8, 11, 0
Offset: 1
Keywords
Links
Programs
-
Mathematica
s[0] = 0; s[1] = 1; s[n_] := s[n] = If[EvenQ[n], s[n/2], s[(n-1)/2] + s[(n+1)/2]]; a[n_] := a[n] = If[n == 1, 1, -Sum[s[n/d] a[d], {d, Most@ Divisors[n]}]]; Array[a, 100] (* Jean-François Alcover, Feb 16 2020 *)
-
PARI
A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487 A317843(n) = if(1==n,1,-sumdiv(n,d,if(d
A002487(n/d)*A317843(d),0)));
Formula
a(1) = 1; for n > 1, a(n) = -Sum_{d|n, dA002487(n/d)*a(d).