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

Home > Numbers
PanMagic (Posted on 2007-03-02) Difficulty: 4 of 5
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.)
Solution computer solution | Comment 1 of 5

DATA  "13 11 16  6 21 11  6 15 27"
DATA  "10 19  9 16 13 10 19 17 13"
DATA  "13 25  7  6 21  9 13  8 13"
DATA  " 9 10  5 19  9 20 14 18  8"
DATA  "16 12 23  9 16 11  6 16 26"
DATA  "18 14 15 18 13 10 19 17 13"
DATA  " 6 25 13  6 13  9 13  8  9"
DATA  "15 20 14 19  8 20 14 18  8"
DATA  " 9 11  6  9 27 11  6 16 27"
DATA  "18 19 16 18  8 19 17 13  8"
 
DATA  " 5  1 14 10  5  1"
DATA  " 6  5  9 11  6  5"
DATA  "12 16 15  4 12 16"
DATA  " 8  7  2 13  8  7"
DATA  " 5  1 14 10  5  1"
DATA  " 6  5  9 11  6  5"

CLS

DIM g1(15, 15)

FOR i = 1 TO 10
 READ l$
 FOR j = 1 TO 9
  g1(i, j) = VAL(MID$(l$, 3 * j - 2, 2)): PRINT g1(i, j);
 NEXT
 PRINT
NEXT

FOR i = 1 TO 6
 READ l$
 FOR j = 1 TO 6
  g2(i, j) = VAL(MID$(l$, 3 * j - 2, 2)): PRINT g2(i, j);
 NEXT
 PRINT
NEXT

FOR c = 1 TO 9
 FOR r = 1 TO 10
  t = 0
  FOR i = r TO r + 3
   t = t + g1(i, c)
  NEXT
  below1(r, c) = t
 NEXT
NEXT

FOR r = 1 TO 10
 FOR c = 1 TO 9
  t = 0
  FOR i = c TO c + 3
   t = t + g1(r, i)
  NEXT
  toRight1(r, c) = t
 NEXT
NEXT

FOR c = 1 TO 6
 FOR r = 1 TO 6
  t = 0
  FOR i = r TO r + 3
   t = t + g2(i, c)
  NEXT
  below2(r, c) = t
 NEXT
NEXT

FOR r = 1 TO 6
 FOR c = 1 TO 6
  t = 0
  FOR i = c TO c + 3
   t = t + g2(r, i)
  NEXT
  toRight2(r, c) = t
 NEXT
NEXT

FOR r = 1 TO 10
 FOR c = 1 TO 9
  PRINT below1(r, c); toRight1(r, c); ",";
 NEXT
 PRINT
NEXT
PRINT

FOR r = 1 TO 6
 FOR c = 1 TO 6
  PRINT below2(r, c); toRight2(r, c); ",";
 NEXT
 PRINT
NEXT
PRINT

FOR r1 = 1 TO 10
 FOR c1 = 1 TO 9
  FOR r2 = 1 TO 6
   FOR c2 = 1 TO 6
    IF below1(r1, c1) + below2(r2, c2) = below1(r1, c1 + 1) + below2(r2, c2 + 1) THEN
    IF below1(r1, c1 + 1) + below2(r2, c2 + 1) = below1(r1, c1 + 2) + below2(r2, c2 + 2) THEN
    IF below1(r1, c1 + 2) + below2(r2, c2 + 2) = below1(r1, c1 + 3) + below2(r2, c2 + 3) THEN
    IF toRight1(r1, c1) + toRight2(r2, c2) = toRight1(r1 + 1, c1) + toRight2(r2 + 1, c2) THEN
    IF toRight1(r1 + 1, c1) + toRight2(r2 + 1, c2) = toRight1(r1 + 2, c1) + toRight2(r2 + 2, c2) THEN
    IF toRight1(r1 + 2, c1) + toRight2(r2 + 2, c2) = toRight1(r1 + 3, c1) + toRight2(r2 + 3, c2) THEN
    IF toRight1(r1 + 2, c1) + toRight2(r2 + 2, c2) = below1(r1, c1) + below2(r2, c2) THEN
     PRINT r1; c1, r2; c2
     FOR i = 0 TO 3
      FOR j = 0 TO 3
       PRINT USING "###"; g1(r1 + i, c1 + j) + g2(r2 + i, c2 + j);
      NEXT
      PRINT
     NEXT
     PRINT
    END IF
    END IF
    END IF
    END IF
    END IF
    END IF
    END IF
   NEXT
  NEXT
 NEXT
NEXT


is designed to look for a 4x4 square with merely the same row and column totals, without bothering to check the diagonals (neither the ordinary diagonals nor the special marked positions making a square PanMagic).

The significant part of its output is

 3  2          2  2
 30 16 17 27
 26 20 23 21
 19 25 22 24
 15 29 28 18
 6  5          2  2
 18 19 30 23
 29 24 17 20
 15 22 27 26
 28 25 16 21

which shows that such column and row matches occur in two places: row 3, column 2 of the larger grid and row 2 column 2 of the smaller grid being the top left corner of the 4x4 square which is the first; and row 6, column 5 of the larger, overlain by row 2 column 2 of the smaller to form the upper left corner of the second.

The first 4x4 is not PanMagic: each of its columns and rows adds to 90, but the 17+21+19+29 of a specified pattern add up to only 86, while each row or column adds to 90.

The second 4x4 does have the marked positions, as well as each row and each column adding to 90, and so is the needed solution.

Row 6, column 5, of the larger grid is Ef, and row 2, column 2 of the smaller grid is Qq.

So the answers are:

1. magic constant = 90

2. Ef and Qq


  Posted by Charlie on 2007-03-03 00:44:17
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information