All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 PanMagic (Posted on 2007-03-02)
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

 See The Solution Submitted by brianjn Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: Programming Lessons here. | Comment 3 of 4 |
(In reply to Programming Lessons here. by brianjn)

The version of Basic is QuickBasic, which preceded QBasic, and was faster (the former was sold as a product while the latter was included with later versions of DOS). They share a syntax for the most part.

In either, as in GWBASIC, arrays of dimension 10 in all dimensions (i.e., 10 or 10,10 or 10,10,10) do not need a DIM statement-- their first use defines the extent of all used dimensions as 10.  Only the array for the larger grid needed to be larger than 10, and that only because I was constructing the auxiliary array of the sum of 4 in a row below and 4 in a row to the right, and rather than stop adding beyond row 10 or column 9, I added in the zeros.

 Posted by Charlie on 2007-03-13 09:45:00

 Search: Search body:
Forums (0)