%I #18 Sep 08 2022 08:45:45
%S 0,1,0,2,1,1,0,3,2,3,1,2,1,1,0,4,3,5,2,5,3,3,1,3,2,3,1,2,1,1,0,5,4,7,
%T 3,8,5,5,2,7,5,7,3,5,3,3,1,4,3,5,2,5,3,3,1,3,2,3,1,2,1,1,0,6,5,9,4,11,
%U 7,7,3,11,8,11,5,8,5,5,2,9,7,11,5,11,7,7,3,7,5,7,3,5,3,3,1,5,4,7,3,8,5,5,2
%N a(n) = number of distinct integers that can be constructed by removing one or more 0's from the binary representation of n, and concatenating while leaving the remaining digits in their same order.
%H Robert Israel, <a href="/A161225/b161225.txt">Table of n, a(n) for n = 1..10000</a>
%e 20 in binary is 10100. By removing one, two, or three 0's from this, we can come up with these distinct integers written in binary: 1100, 1010, 110, 101, 11. There are five of these, so a(20) = 5.
%p g:= proc(n) n + 2^(ilog2(n)) end proc:
%p h:= proc(n) n + 2^(1+ilog2(n)) end proc:
%p f:= proc(n) option remember; local S, k, r;
%p k:= ilog2(n)-1; r:= floor(n/2^k);
%p if r = 2 then S:= procname(n-2^k); {n-2^k} union S union map(g,S)
%p else map(h, procname(n - 2^(k+1)))
%p fi
%p end proc:
%p f(1):= {}: f(2):= {1}:
%p seq(nops(f(n)),n=1..200); # _Robert Israel_, Apr 12 2020
%o (Magma) ndi:=function(n) a:=Intseq(n, 2); p:=1; c:=1; for j:=1 to #a do if a[j] eq 0 then c+:=1; else p*:=c; c:=1; end if; end for; return p-1; end function; [ ndi(n): n in [1..103] ]; // _Klaus Brockhaus_, Jun 10 2009
%Y Cf. A007088 (numbers written in base 2). - _Klaus Brockhaus_, Jun 10 2009
%K base,nonn,look,hear
%O 1,4
%A _Leroy Quet_, Jun 06 2009
%E Extended by _Ray Chandler_, Jun 09 2009
%E More terms from _Klaus Brockhaus_, Jun 10 2009