The grid to the left is cyclical over 4 rows and 4 columns. A 4 x 4 grid,
when suitably selected and appropriately overlaid upon the left grid with
their matching cells added, becomes a panmagic square.
| | | | | | | | | | | | | | | | | | | | | |
| | A | B | C | D | E | F | G | H | I | | | P | Q | R | S | T | U | | | |
| a | 13 | 11 | 16 | 6 | 21 | 11 | 6 | 15 | 27 | | p | 5 | 1 | 14 | 10 | 5 | 1 | | | |
| b | 10 | 19 | 9 | 16 | 13 | 10 | 19 | 17 | 13 | | q | 6 | 5 | 9 | 11 | 6 | 5 | | | |
| c | 13 | 25 | 7 | 6 | 21 | 9 | 13 | 8 | 13 | | r | 12 | 16 | 15 | 4 | 12 | 16 | | | |
| d | 9 | 10 | 5 | 19 | 9 | 20 | 14 | 18 | 8 | | s | 8 | 7 | 2 | 13 | 8 | 7 | | | |
| e | 16 | 12 | 23 | 9 | 16 | 11 | 6 | 16 | 26 | | t | 5 | 1 | 14 | 10 | 5 | 1 | | | |
| f | 18 | 14 | 15 | 18 | 13 | 10 | 19 | 17 | 13 | | u | 6 | 5 | 9 | 11 | 6 | 5 | | | |
| g | 6 | 25 | 13 | 6 | 13 | 9 | 13 | 8 | 9 | | | | | | | | | | | |
| h | 15 | 20 | 14 | 19 | 8 | 20 | 14 | 18 | 8 | | | | | | | | | | | |
| i | 9 | 11 | 6 | 9 | 27 | 11 | 6 | 16 | 27 | | | | | | | | | | | |
| j | 18 | 19 | 16 | 18 | 8 | 19 | 17 | 13 | 8 | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | |
Tell me:
1. the
magic constant of your grid
and
2. the
two cells which overlapped to form the top left corner of your newly formed grid, eg: Bb and Qr.
That example, Bb and Qr above, would choose the subsets:
| | | | | | | | | | | | | | | | | | | |
Bb | 19 | 9 | 16 | 13 | | | Qr | 16 | 15 | 4 | 12 | | | | 35 | 24 | 20 | 25 | |
| 25 | 7 | 6 | 21 | | + | | 7 | 2 | 13 | 8 | | = | | 32 | 9 | 19 | 29 | |
| 10 | 5 | 19 | 9 | | | | 1 | 14 | 10 | 5 | | | | 11 | 19 | 29 | 14 | |
| 12 | 23 | 9 | 16 | | | | 5 | 9 | 11 | 6 | | | | 17 | 32 | 20 | 22 | |
| | | | | | | | | | | | | | | | | | | |
of which the latter is NOT a magic square.
Oh! And be careful that any magic square chosen is in fact Pan Magic!
Other than rows, columns and major diagonals, the following arrangements, as well as their rotations also form the magic constant.
The following definition extracted from wikipedia applies here (and is demonstrated by the first two 4 x 4 grids above).
A panmagic square is a magic square with the additional property that the broken diagonals, i.e. the diagonals that wrap round at the edges of the square, also add up to the magic constant.
http://en.wikipedia.org/wiki/Panmagic_square
I don't think I'm promoting this comment too highly with my subject title; this should be in the Solution, but I've shut myself out!!
I had a format which I did want posted, it was available, but who put
it here was clearly unaware of its existence (wonder if Levik can amend
that, ie, replace the above with my desired format).
I commend Charlie upon his insights in analysing problems down to their
basic elements. While in the darkest depths of my imagination I knew
such a task was possible but I did not expect such an outcome here.
Programming language?
Looks like QBasic but there are things which I don't recognise (think there should be declarations).
Doesn't matter.
It should take little adaptation to convert this to a Basic of some
other form (er .. how available are those languages .. I have a few
... one archaic being GWBasic somewhere on flopply.
[For higher languages - C, C++, ?? , Charlie gives a solid 'pseudocode' which might relate to similar circumstances.]
|
Posted by brianjn
on 2007-03-13 06:47:36 |