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

Home > General
Primal Magic Square (Posted on 2004-03-09) Difficulty: 4 of 5
Find a 3x3 magic square that is composed of 9 prime numbers (not the numbers from 1-9) and show how you found it.

(A magic square, as you may already know, is one in which the respective sums of the numbers in all the rows, columns, and both major diagonals all add up to the same number.)

Since "Magic Square" is a term used outside the scope of this problem, I'm sure you can find an answer on the internet. Please find a solution independently.

See The Solution Submitted by SilverKnight    
Rating: 3.0000 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): More Solutions | Comment 14 of 15 |
(In reply to re: More Solutions by Thalamus)

I found the first two by hand using the matrix equation from my first post.  The other three were found using a computer program searching all primes up to 300.  I got lucky when I found the twin prime squares.

Extending the algorithm found 159 prime magic squares with all entries less than 1000.  If the number 1 is included, there are four more.

After modifying the algorithm slightly, I found that there were 15,858 solutions with all entries less than 10,000.  There are 41 more solutions when 1 is included.

The program I used is below.  It is written for UBASIC 8.74.  P is the largest prime in a solution, and B and C are solution parameters:

Solution generated by p,b,c
[P -6B-12C  P        P-12B -6C]
[P-12B   P -6B -6C  P   -12C]
[P -6C  P-12B-12C P- 6B ]

   10   Start=37
   20   Limit=1000
   30   P=Start
   40   while P<Limit
   50   Bcmax=P\12
   60   for Bcsum=3 to Bcmax
   70   for B=2 to (Bcsum-1)
   80   C=Bcsum-B
   85   if C>=B then 190
   90   if not fnIsPrime(P-6*B) then 190
  100   if not fnIsPrime(P-12*B) then 190
  110   if not fnIsPrime(P-6*C) then 190
  120   if not fnIsPrime(P-12*C) then 190
  130   if not fnIsPrime(P-6*B-6*C) then 190
  140   if not fnIsPrime(P-12*B-6*C) then 190
  150   if not fnIsPrime(P-6*B-12*C) then 190
  160   if not fnIsPrime(P-12*B-12*C) then 190
  170   if B=(2*C) then 190
  180   print P,B,C,
  182   Solutions=Solutions+1
  184   if (P-12*B-12*C)>1 then 189
  186   print "*";
  188   One=One+1
  189   print " "
  190   next B
  200   next Bcsum
  210   P=nxtprm(P)
  220   wend
  225   print Solutions,One
  230   end
  320   fnIsPrime(Number)
  330   Returnvalue=0
  340   if nxtprm(Number-1)-Number=0 then Returnvalue=1
  345   if Number=1 then Returnvalue=1
  350   return(Returnvalue)

  Posted by Brian Smith on 2004-03-11 21:09:13
Please log in:
Remember me:
Sign up! | Forgot password

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

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information