Gray code by 51b

-module(g).
-export([m/0]).
m()->{_,[N]}=io:fread('',"~d"),F={io,format},F("Gray code  n=~p",[N]),[F("
~*.2.0b",[N,M bsr 1bxor M])||M<-lists:seq(0,1bsl N-1)].

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

download

return to the top page