Magic square by primo

r=0...x=gets.to_i
r.map{|j|puts r.map{|i|'%3s'%(1+((j-i-=x/2)%x*-~x-x*i)%x**2)}*' '}

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

download

return top