r=range(-23,24) for y in r: s="" for x in r:p=x*x+y*y or 1;s+=" [ ]"[p**.5%16in[7,3,11]or~-2**p%p==1::2] print s

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

download

return top