Sierpinski Carpet by murky-satyr

f=math.floor
n=3^io.read()-1
for y=0,n do
for x=0,n do
io.write((x%3*(y%3)==1 or f(x/3%3)*f(y/3%3)==1 or f(x/9%3)*f(y/9%3)==1)and'  'or'::')end
print()end

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

download

return to the top page