OFFSET
0,7
COMMENTS
Equivalently, change bits 01 -> 0, including a 0 reckoned above the most significant 1-bit of n so change there.
A single 1-bit run decreases to nothing. The Fibbinary numbers (A003714) are those n with only single 1-bits so that a(n) = 0 iff n is in A003714.
a(n) = 1 iff n is in A213540 since those values end with bits 011 (which become 01) and otherwise have only single 1-bits, as do the Fibbinary numbers.
LINKS
EXAMPLE
n = 14551 = binary 111 000 11 0 1 0 111
a(n) = 787 = binary 11 000 1 0 0 11
MATHEMATICA
Table[FromDigits[Flatten[Split@IntegerDigits[n, 2]/. {1, a___}:>{a}], 2], {n, 0, 82}] (* Giorgos Kalogeropoulos, Nov 01 2021 *)
PROG
(PARI) a(n) = my(v=binary(n), t=0); for(i=2, #v, if(v[i-1]||!v[i], v[t++]=v[i])); fromdigits(v[1..t], 2);
(Python)
def a(n): return int(bin(n).replace("b", "").replace("01", "0"), 2)
print([a(n) for n in range(83)]) # Michael S. Branicky, Oct 31 2021
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Kevin Ryde, Oct 30 2021
STATUS
approved