Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Filter all solution in Clear category for Magic Square by veky
def checkio(s):
n,a=len(s),sum(s,[])
if all(sum(t)*2==n+n**3 for t in filter(all,s+
list(zip(*s))+[a[::n+1],a[::n-1][1:-1]])):
try: i,j=divmod(a.index(0),n)
except ValueError: return s
for r in set(range(1,n*n+1)).difference(a):
s[i][j]=r
t=checkio(s)
if t: return t
s[i][j]=0
July 30, 2013
Comments: