Given an integer, compute its Levenshtein code
Haskell, 70 bytes
b 0=[]
b n=b(div n 2)++[mod n 2]
f 0=[0]
f n|1:t<-b n=1:f(length t)++t
Defines a function f : Int -> [Int]
. For example, f 5 == [1,1,1,0,0,0,1]
.
Python, 49 bytes
f=lambda n:n and'1%s'%f(len(bin(n))-3)+bin(n)[3:]
Test it on Ideone.
Mathematica, 61 bytes
f@0={0};f@n_:=Join[{1},f@Length@#,#]&@Rest@IntegerDigits[n,2]