OFFSET
0,8
FORMULA
a(0) = 0, a(n) = A001316(n-m)-1, where m is the highest power of 2 less than n. - Emmanuele Villa, Nov 19 2016
a(2*n) = a(n), a(2*n + 1) = 2*a(n) + 1. - Michael Somos, Dec 04 2016
EXAMPLE
G.f. = x^3 + x^5 + x^6 + 3*x^7 + x^9 + x^10 + 3*x^11 + x^12 + 3*x^13 + 3*x^14 + ...
From Emmanuele Villa, Nov 19 2016: (Start)
MATHEMATICA
Table[2^DigitCount[# - 2^(Floor@ Log2@ # - Boole@ IntegerQ@ Log2@ #) - 1 + Boole[# == 1]/2, 2, 1] - 1 &[n + 1], {n, 0, 72}] (* Michael De Vlieger, Nov 18 2016 *)
a[ n_] := Which[ n < 3, 0, EvenQ[n], a @ Quotient[n, 2], True, a[ Quotient[n, 2]] 2 + 1]; (* Michael Somos, Dec 04 2016 *)
PROG
(PARI) a(n) = sum(m=1, n\2, bitxor(m, n-m)==n); \\ Michel Marcus, Dec 03 2016
(PARI) {a(n) = if( n<3, 0, n%2, a(n\2)*2 + 1, a(n\2))}; /* Michael Somos, Dec 04 2016 */
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Naohiro Nomoto, Nov 14 2003
STATUS
approved