Sierpinski Carpet by nils

b(x,y){return(x<3&&y<3)?!(x&y&1):b(x/3,y/3)*b(x%3,y%3);}i,j,l;main(){l=scanf("%\\x0d
d",&i);while(i--)l*=3;for(j=0;j<l*l;){printf("%.*s",2+!(++j%l),b(j/l,j%l)?"::\\x0d
\n":"  \n");}}\x0d

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

download

return to the top page