Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
magic squares in k
/ https://en.wikipedia.org/wiki/Siamese_method
msq: {[m] s:(-1+m*m) (1 -1 +)\ (_ m%2; 0); 1+/.[m#,m#0; ; :; ]'[(s+2 -1*/:,/m#/:!m)!m; !#s]}
msq 3
(8 3 4
1 5 9
6 7 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.