Magic squares of odd order: Difference between revisions

Add APL
(Add Draco)
(Add APL)
Line 380:
</pre>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
{{trans|C}}
<lang APL>magic←{⍵{+/1,(1 ⍺⍺)×⍺(⍺⍺|1+⊢+2×⊣)⍵,⍺⍺-⍵+1}/¨⎕IO-⍨⍳⍵ ⍵}</lang>
{{out}}
<pre> magic¨ 1 3 5 7
1 2 9 4 2 23 19 15 6 2 45 39 33 27 21 8
7 5 3 14 10 1 22 18 18 12 6 49 36 30 24
6 1 8 21 17 13 9 5 34 28 15 9 3 46 40
8 4 25 16 12 43 37 31 25 19 13 7
20 11 7 3 24 10 4 47 41 35 22 16
26 20 14 1 44 38 32
42 29 23 17 11 5 48 </pre>
=={{header|AppleScript}}==
{{trans|JavaScript}}
2,115

edits