login
A090078
In binary expansion of n, reduce contiguous blocks of 0's to 0.
3
0, 1, 2, 3, 2, 5, 6, 7, 2, 5, 10, 11, 6, 13, 14, 15, 2, 5, 10, 11, 10, 21, 22, 23, 6, 13, 26, 27, 14, 29, 30, 31, 2, 5, 10, 11, 10, 21, 22, 23, 10, 21, 42, 43, 22, 45, 46, 47, 6, 13, 26, 27, 26, 53, 54, 55, 14, 29, 58, 59, 30, 61, 62, 63, 2, 5, 10, 11, 10, 21, 22, 23, 10, 21
OFFSET
0,3
FORMULA
a(a(n)) = a(n).
a(A090077(n)) = A090077(a(n)) = A090079(n).
EXAMPLE
100 -> '1100100' -> 11[00]1[00] -> 11[0]1[0] -> '11010' -> 26=a(100).
PROG
(PARI) a(n)=my(v=binary(n), t); for(i=1, #v, if(v[i], t+=t+1, t%2, t+=t)); t \\ Charles R Greathouse IV, Aug 17 2016
(Python)
def a(n):
b = bin(n)[2:]
while "00" in b: b = b.replace("00", "0")
return int(b, 2)
print([a(n) for n in range(81)]) # Michael S. Branicky, Jul 27 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Reinhard Zumkeller, Nov 20 2003
STATUS
approved