# A 4 x 4 Magic Square with Pairwise Relatively Prime Entries

Find a 4 x 4 magic square of positive integers such that any two of its entries are pairwise different and relatively prime, i.e., have no common divisor greater than 1.

What is the least that the largest number in such a square can be?

• What is “pairwise different”? Feb 10, 2019 at 14:56
• @ArvasuKulkarni: Any two entries are different. They are also relatively prime, that is, they do not have a common divisor greater than 1. Feb 10, 2019 at 14:59
• @Brandon_J: An oldie twisted. Feb 10, 2019 at 21:54
• Wow, that's the best puzzle I ever encountered here (and I've been a lurker for more than a year, I think). A question about the definition: can the square contain a 1, i. e. is 1 considered a coprime to any other natural number or not? It commonly is, but not always. Feb 11, 2019 at 0:08

I believe this is optimal (unless I've missed a trick):

  1 13 47 53
29 59  7 19
41 11 37 25
43 31 23 17

Which has

a maximal value of 59 (and a sum of 114)

Note: all values are prime except for 1 and the composite number 25

I also found these two with the same maximum value:

  1 17 37 59
53 29 23  9
47 19 43  5
13 49 11 41
...using primes, 1, 9 and 49 (with a sum of 114);
and
  1 29 47 49
43 41 37  5
59 17 31 19
23 39 11 53
...using primes, 1, 39 and 49 (with a sum of 126)

First I found these two:

 1 11 41 61
47 31 17 19
43 13 53  5
23 59  3 29

and
 1 13 47 53
29 59  7 19
61 31 17  5
23 11 43 37

both of which have a maximal value of 61 (and a sum of 114)

For these I restricted myself to fifteen odd primes less than 73 and added the number one as the sixteenth value. These two have the smallest maximal value given this additional constraint.

• markfarrar.co.uk/msq4x4cm.htm does not like your solution, but I can't find the error. Feb 10, 2019 at 22:22
• The diagonals work, but not whatever else this considers when deciding if it is "perfect" - looking at the results when you give a magic total it seems to want squares and offset 2-by-1s or 1-by-2s and non-main diagonals. Feb 10, 2019 at 22:35
• Oh dang. Can I give you a +47 or so for finding this answer? Feb 10, 2019 at 22:35
• Just found better :p Feb 10, 2019 at 22:40

I've got a solution:

and I admit I found it online.

Here it is:

The largest number in it is

73

• Maybe we can make a smaller one by using 1 as one of our numbers? Feb 10, 2019 at 20:56
• I'm not sure. I feel like I found a pretty reliable source @JonathanAllan Feb 10, 2019 at 20:56
• I am not doubting Mathworld as a source, but did A. W. Johnson, Jr allow 1 or not? Feb 10, 2019 at 21:00
• @JonathanAllan ah, I see what you mean. Does the OP allow the number one? I guess I should ask. Feb 10, 2019 at 21:04
• 1 is co-prime to all other integers. Note that I asked if we are only allowed positive integers because the same is true of -1. Feb 10, 2019 at 21:06

The following magic square

 11  1 53 37
7 47 29 19
71 23  3  5
13 31 17 41

has magic constant

102

and largest number

71