Problems & Puzzles: Puzzles

Puzzle 4.- Prime - magical squares

Jaime Ayala and myself asked each other very recently for a type of magic squares with the peculiarity that each of the rows, columns and major diagonals should be distinct, reversible and non-palindrome primes. We called this kind of matrixes "prime-magical squares"

Our search concluded that :

a.There are not any prime-magical squares for the 2x2 and 3x3 cases.

b.There is one solution for the case 4x4 :

1933
1283
9551
3719………….20 primes 4 digits each, inside

by the way, we conjecture that this is the only solution available for this case.

c. we have found three solutions for the 5x5 case :

 

11933
72353
16111
11149
71399
11933
72353
16111
11149
79399
19333
16223
11621
98999
71399

………….24 primes 5 digits each, inside

 

d.we have found two solutions for the 6x6 case :

 

139339
371719
968173
340369
981391
731933
133319
955991
368369
993943
393299
791993

………….28 primes 6 digits each, inside

We obtained the before shown matrixes observing that the "wall" of the matrixes should not contain even digits. Then we choose appropriate matching 5 or 6 digits reversible non-palindrome primes for the wall and started looking for the inner digits using a code that implement a combination of trial & error and a systematic "optimizing" of the matrix procedure.

In this case are asking if you devise a general and non trial-error procedure for obtaining this kind of solutions.

What about a genetic approach ?


Solution

Harvey Heinz (see my Link # 20 to his very interesting Web pages) is reporting that two other persons worked several years ago with this "prime magical squares". They called this matrixes "perfect prime squares".

The first one who worked on this subject is Les Card and published his results as "Patterns in Primes" at the "Journal of Recreational Mathematics, 1:2, pp 93-99, April 1968. He found the same 4x4 we found 30 years later ! ! !… and other 3 matrixes 5x5 totally different to ours. This are the Les Card ones :

13933 11731 99139
13457 72251 11497
76403 31859 16193
74897 90793 93487
71399 39113 31393

Later, Charles Trigg reproduced the Les Card results and added some other 4x4 matrixes in the "Journal of Recreational Mathematics", vol. 17, # 2, 1984-1985.

But none of the added matrixes have 20 primes, just 18 because he is using one reversible primes in two rows and/or column different, breaking the condition of our puzzle that rules that you should use only "distinct reversible and non-palindrome primes"

For example, in the following square

1193
9001
1229
3191

the first column and the last row are the same reversible prime.

The best new for us is that neither Trigg nor Les Card found any of 6x6 order prime magical square ! …. while we have found last March two of them…Excellent news!…. and many thanks to Harvey.

***

At 14/05/99 Wilfred Whiteside informed that he has calculated all the solutions for the 5x5 case and found that there are 253,688 different matrixes containing 24 unique primes. He has stored all these solutions in 6 text files available on request.

In a separate e-mail but the same day, and for the 4x4 matrixes, he also wrote: "I just reran my program for all possible 4x4 solutions ...The only solution after symmetry elimination was your solution...A total of 4653 arrays were analyzed, yielding 4 equivalent versions of your solution".

After the Whiteside's work we can say that the 4x4 and 5x5 matrixes have been exhaustively investigated and solved, remaining only to know how many different solutions exists for the 6x6 case. But the task seem to be unaffordable. In his own words, Whiteside says "I definitely will not try to analyze all possible 6x6 solutions since there are probably several million sets of "walls" and for each of these, there are probably many tens of millions of ways to fill them in.  It would not surprise me to find out that there are a few billion solutions to the 6x6 case."

Nevertheless, one day after Whiteside sent to me some "exotic" solutions for the 6x6 case. I have copied only a few of them:

Some Exotic Prime-Magical Matrixes - 6x6 Case, with only 0,2,4 allowed in the interior (only 3 solutions exist):

1 1 3 1 3 1    1 3 3 3 7 9    3 1 9 1 1 7 
3 0 4 4 2 9    7 4 2 2 2 9    1 2 2 0 4 1 
7 2 0 2 2 9    1 4 0 2 2 1    9 4 0 2 4 9  
7 0 4 0 2 7    9 2 0 2 0 9    9 4 2 0 4 1  
1 4 2 0 4 9    3 2 2 2 4 9    1 2 0 4 2 7  
3 3 9 7 9 9    7 1 7 9 7 9    9 9 9 3 7 7

Now you know it... Whiteside has the key of this puzzle....

***
A great jump has been done by a new puzzler, Jurgen T.W.A. Baumann, from Germany: a 11x11 solution!!!.... This solution has been sent to me at 11/06/99, but Jurgen says that he found it "last year".

37979913973
79191917999
71191939799
11113799771
11171719331
17371793711
17991311333
39191911337
77997113791
79333777739
33933913913

Here are also the 7x7, 8x8, 9x9 &10x10 solutions he has found:

1713997
1977779
1977737
1193771
7931771
1911733
1911317

33117379
73997179
77971717
73131791
13391731
13911119
91799117
39777131

933737713
779933137
331771777
311977339
793193131
991791799
319979917
311319971
379779973

7717991399
7799191973
7911711139
3993993373
9111119737
1131911311
3371973193
7199177773
1933997917
7913997997

T.W.A. Baumann
also has sent - on request - the method he has employed:

"... here are some details from my 'recipe' (11*11):
  - generate all reversible non-palindrome primes of 11 digits (use only
    digits 1,3,7,9) --> string-array 1 (1 to 72296 incl. reversals)
  - store the primes in 2D-string-array 2 (111111 to 999999, 1 to 30);
    first index-dim.: the first 6 digits of the prime,
    second index-dim.: primes 1 to n
  - store the actual n of array 2 in an numeric array 3 (111111 to
    999999)
  - store digits 7 to 11 of all primes in string-array 4 (111111 to
    999999); f.e.: primes = 99999913991, 99999917111,..., index =
999999,
    contents = 1a3b9c9d11a7b1c1d1...
  - take 6 primes for the columns 1 to 6 by random from array 1
  - take loops for the rows 1 to 11 in systematical search (use arrays
    2 and 3)
  - beginning after row 7 test the columns 7 to 11 and the 2 diagonals
    with array 4
  - store the results and avoid redundant primes
The 'cooking time' is tolerable. I used a normal PC (PI/266) and the
languages power basic (generating the primes) and VB 5.0 (for the rest)
"
***


Records   |  Conjectures  |  Problems  |  Puzzles