Gray code by sawakami

v=-1,i;main(n){for(printf("Gray code  n=%s",gets(&n));v++<1<<n%8;)putchar(i--?(--v/2^v)>>i&1|48:(i=n%8,10));}

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

download

return to the top page