Elias delta to Fibonacci by yowa

#!ruby -n
~//
(a,*o=b=1
$'=~/.{#{$&.to_i(2)-1}}/
o[0,0],=(a,b=b,a+b)until b>x="1#$&".to_i(2)
$><<o.map{|a|a>x ?0:(x-=a;1)}.reverse<<1)while($'=~/0*/;$'=~/..{#{$&.size}}/)
puts

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

download

return to the top page