Gray code by samuil

puts"Gray code  n=%d"%n=gets.to_i\x0d
(2**n).times{|a|puts"%0#{n}b"%(a^a/2)}

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

download

return to the top page