login
In binary expansion of n, reduce contiguous blocks of 0's to 0.
3

%I #17 Jul 28 2022 09:23:13

%S 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,

%T 27,14,29,30,31,2,5,10,11,10,21,22,23,10,21,42,43,22,45,46,47,6,13,26,

%U 27,26,53,54,55,14,29,58,59,30,61,62,63,2,5,10,11,10,21,22,23,10,21

%N In binary expansion of n, reduce contiguous blocks of 0's to 0.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(a(n)) = a(n).

%F a(A090077(n)) = A090077(a(n)) = A090079(n).

%e 100 -> '1100100' -> 11[00]1[00] -> 11[0]1[0] -> '11010' -> 26=a(100).

%o (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

%o (Python)

%o def a(n):

%o b = bin(n)[2:]

%o while "00" in b: b = b.replace("00", "0")

%o return int(b, 2)

%o print([a(n) for n in range(81)]) # _Michael S. Branicky_, Jul 27 2022

%Y Cf. A007088, A090079, A090077.

%K nonn,base,easy

%O 0,3

%A _Reinhard Zumkeller_, Nov 20 2003