Magic square by rst76

main=interact$(reverse!).read
r!n=unlines[unwords[r$take 3$r$"  "++show(n*mod(y-2*x)n+mod(y-x+div n 2)n+1)|x<-[1..n]]|y<-[1..n]]

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

download

return to the top page