n=input() print 'Gray code n=%s'%n for i in range(2**n): i=i^i>>1;b='';m=n while m:b='01'[i&1]+b;m-=1;i>>=1 print b
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page