%I #14 Dec 26 2013 09:42:46
%S 0,0,1,0,3,1,3,0,7,3,6,1,9,3,7,0,15,7,12,3,16,6,12,1,21,9,16,3,21,7,
%T 15,0,31,15,24,7,30,12,22,3,36,16,27,6,34,12,24,1,45,21,34,9,42,16,30,
%U 3,49,21,36,7,45,15,31,0,63,31,48,15,58,24,42,7,66,30,49,12,60,22,42,3,76,36,57
%N a(2n) = a(n) + n, a(2n+1) = a(n), with a(0)=0.
%C For every zero bit in the binary representation of n, add the number represented by the substring left of it.
%H Antti Karttunen, <a href="/A233931/b233931.txt">Table of n, a(n) for n = 0..8192</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = sum(k=0..floor(log(n)/log(2)), (1-bittest(n,k)) * floor(n/2^(k+1)) ) = sum(k=0..A000523(n), !A030308(n,k+1) * floor(n/2^(k+1)) ), with bittest(n,k)=0 or 1 according to the k-th bit of n (the zeroth bit the least significant).
%F a(n) = A011371(n) - A233905(n).
%e 17 is 10001 in binary, so we add 1, 10=2, and 100=4 so a(17)=7.
%e 27 is 11011 in binary, so we add 11=3, so a(27)=3.
%o (PARI) a(n)=sum(k=0,floor(log(n)/log(2)),(1-bittest(n,k))*floor(n/2^(k+1)))
%o (PARI) a(n)=b=binary(n);sum(k=1,#b,(!b[k])*sum(i=1,k-1,b[i]*2^(k-1-i)))
%o (PARI) a(n)=if(n<1,0,if(n%2,a(n\2),a(n/2)+n/2))
%o (Scheme, with memoizing definec-macro from Antti Karttunen's IntSeq-library)
%o (definec (A233931 n) (cond ((zero? n) n) ((even? n) (+ (A233931 (/ n 2)) (/ n 2))) (else (A233931 (/ (- n 1) 2)))))
%o ;; _Antti Karttunen_, Dec 21 2013
%K nonn
%O 0,5
%A _Ralf Stephan_, Dec 18 2013