n=input("Gray code n=") print n i=x=0 exec"x^=(i&-i)**3;print'%%0%do'%n%x;i+=1;"*2**n
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page