Elias delta to Fibonacci by oto-oto-oto

#!ruby -p
def f n
a,b=0,1
n.times{a,b=b,a+b}
b
end
loop{break if !/0*1/
x=$_.slice!(0,2*$&.size-1).to_i(2)-1
a=2**x+$_.slice!(0,x).to_i(2)
d=[]
while a!=0
i=1
i+=1until f(i)>a
d[i-2]=1
a-=f(i-1)
end
$><<d.map{|i|i.to_i}.join+'1'}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page