# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a233931 Showing 1-1 of 1 %I A233931 #14 Dec 26 2013 09:42:46 %S A233931 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 A233931 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 A233931 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 A233931 a(2n) = a(n) + n, a(2n+1) = a(n), with a(0)=0. %C A233931 For every zero bit in the binary representation of n, add the number represented by the substring left of it. %H A233931 Antti Karttunen, Table of n, a(n) for n = 0..8192 %H A233931 Index entries for sequences related to binary expansion of n %F A233931 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 A233931 a(n) = A011371(n) - A233905(n). %e A233931 17 is 10001 in binary, so we add 1, 10=2, and 100=4 so a(17)=7. %e A233931 27 is 11011 in binary, so we add 11=3, so a(27)=3. %o A233931 (PARI) a(n)=sum(k=0,floor(log(n)/log(2)),(1-bittest(n,k))*floor(n/2^(k+1))) %o A233931 (PARI) a(n)=b=binary(n);sum(k=1,#b,(!b[k])*sum(i=1,k-1,b[i]*2^(k-1-i))) %o A233931 (PARI) a(n)=if(n<1,0,if(n%2,a(n\2),a(n/2)+n/2)) %o A233931 (Scheme, with memoizing definec-macro from Antti Karttunen's IntSeq-library) %o A233931 (definec (A233931 n) (cond ((zero? n) n) ((even? n) (+ (A233931 (/ n 2)) (/ n 2))) (else (A233931 (/ (- n 1) 2))))) %o A233931 ;; _Antti Karttunen_, Dec 21 2013 %K A233931 nonn %O A233931 0,5 %A A233931 _Ralf Stephan_, Dec 18 2013 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE