Magic squares of doubly even order: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: optimized the MAX# subroutine.) |
m (→{{header|REXX}}: changed wording in the REXX section header.) |
||
Line 1,023: | Line 1,023: | ||
<!-- I couldn't figure out the other code's bit shifting and bit ANDing, so I wrote my own algorithm. --> |
<!-- I couldn't figure out the other code's bit shifting and bit ANDing, so I wrote my own algorithm. --> |
||
Marked numbers |
"Marked" numbers (via the '''diag''' subroutine) indicate that those (sequentially generated) numbers don't get |
||
<br>swapped (and thusly, stay in place in the magic square). |
|||
<lang rexx>/*REXX program constructs a magic square of doubly even sides (a size divisible by 4).*/ |
<lang rexx>/*REXX program constructs a magic square of doubly even sides (a size divisible by 4).*/ |
||
n=8; s=n%4; L=n%2-s+1; w=length(n**2) /*size; small sq; low middle; # width*/ |
n=8; s=n%4; L=n%2-s+1; w=length(n**2) /*size; small sq; low middle; # width*/ |