OFFSET
1,4
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
MAPLE
g:= proc(n) n + 2^(ilog2(n)) end proc:
h:= proc(n) n + 2^(1+ilog2(n)) end proc:
f:= proc(n) option remember; local S, k, r;
k:= ilog2(n)-1; r:= floor(n/2^k);
if r = 2 then S:= procname(n-2^k); {n-2^k} union S union map(g, S)
else map(h, procname(n - 2^(k+1)))
fi
end proc:
f(1):= {}: f(2):= {1}:
seq(nops(f(n)), n=1..200); # Robert Israel, Apr 12 2020
PROG
(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
CROSSREFS
AUTHOR
Leroy Quet, Jun 06 2009
EXTENSIONS
Extended by Ray Chandler, Jun 09 2009
More terms from Klaus Brockhaus, Jun 10 2009
STATUS
approved