Magic squares of doubly even order: Difference between revisions
Content added Content deleted
PatGarrett (talk | contribs) (→{{header|ALGOL 60}}: Section added) |
|||
Line 2,288: | Line 2,288: | ||
The magic number is: 260 |
The magic number is: 260 |
||
</pre> |
|||
=={{header|Ring}}== |
|||
<lang ring> |
|||
n=8 |
|||
see "the square order is : " + n + nl |
|||
for i=1 to n |
|||
for j = 1 to n |
|||
x = (i*2-j+n-1) % n*n + (i*2+j-2) % n + 1 |
|||
see "" + x + " " |
|||
next |
|||
see nl |
|||
next |
|||
see "the magic number is : " + n*(n*n+1) / 2 + nl |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
the square order is : 8 |
|||
2 59 52 45 38 31 24 9 |
|||
20 13 6 63 56 41 34 27 |
|||
38 31 24 9 2 59 52 45 |
|||
56 41 34 27 20 13 6 63 |
|||
2 59 52 45 38 31 24 9 |
|||
20 13 6 63 56 41 34 27 |
|||
38 31 24 9 2 59 52 45 |
|||
56 41 34 27 20 13 6 63 |
|||
the magic number is : 260 |
|||
</pre> |
</pre> |
||