I woke up at 5 AM and couldn't get back to sleep. I had an idea. I have long had a mild interest in Magic Squares (a square filled with numbers such that all the rows, columns, and diagonals sum to the same value.) Sarah's book “In Code” discusses 3×3 magic squares like this one that uses the numbers 1 to 9, and sums to 15:
Apparently out of 362,880 (9!) possible arrangements this is the only unique solution. Well… technically there are 8 solutions, but the other 7 are all variants of this solution arising from rotations and reflections. In other words if you were to rotate this square 90 degrees to the left, you get another solution:
Since the square can be rotated into 4 different positions that gives you 4 variations of the same solution. Further, you can take the original square and flip or reflect it along the main diagonal like so:
And this solution can also be rotated into 4 different positions. So 1 solution or 8, depending on how you look at it. I prefer to call it 1 solution.
A lot of research has already been done into magic squares so I started looking at squares of primes (call them “prime squares”). Could I take the first 9 primes and arrange them in a 3×3 square so that every row, column, and diagonal summed to a prime? The answer to that question is NO. The first prime is 2, and all the other primes are odd. Thus any row, column, or diagonal with 2 in it would result in two odd numbers being added to an even number. Two odds plus one even yields another even number, Since 2 is the only even prime, it just wasn't going to work.
So I started looking at the first 9 primes after 2 (AKA: 3, 5, 7, 11, 13, 17, 19, 23, and 29). Using Excel on Pat's laptop I tried many arrangements of these primes but was unable to find one that worked. No matter how I swapped the numbers around, one or more columns, rows, or diagonals would break (sum to a composite number.)
Eventually I decided I was going to have to try a brute force search. Since the table could be easily represented as an array of 9 numbers I wrote some routines in Visual Basic to fully permute such an array, test all the resulting squares and discard any solutions that were simply rotations or reflections of previous solutions.
It turns out that for 3, 5, 7, 11, 13, 17, 19, 23, and 29 there are 116 solutions (928 if you count variants). Here's one:
(The blue cells in the corners show the totals of the diagonals, the other blue cells show the totals of the appropriate columns and rows. As you can see, everything adds up to a prime.) 116… that's a lot of solutions! Then I tried 9 consecutive primes starting at 5: 545 solutions. Starting at 7: 456 solutions. I kept going… were there any that had only one solution?
My first surprise came at 23. The number of solutions for 9 consecutive primes beginning at 23 is zero. I guess there is no way to arrange 23, 29, 31, 37, 41, 43, 47, 53, and 59 in a 3×3 square so that all row, column, and diagonal totals are prime.
I pushed on looking for a square with only one solution. I passed a number that had no solutions, and as I progressed the numbers of solutions got closer and closer to 1… for 53: 10, for 79: 4, for 107: 3, for 199: 2. Finally at 419, the 81'st prime I found a series of 9 consecutive primes that had only 1 possible arrangement in a 3×3 square such that all row, column, and diagonal totals were prime:
| Prime Square 419 |
| |
|
421
|
439
|
431 |
|
449
|
419
|
433 |
|
457
|
461
|
443 |
|
|
|
|
|
|
I realized I had the makings of 3 integer sequences that might be possible candidates for inclusion in the OEIS:
| S1. |
a(n) = The number of solutions (excluding rotations and reflections) for a series of 9 consecutive primes beginning with the n'th prime arranged in a 3×3 square such that all row, column, and diagonal totals are prime.
0, 116, 545, 456, 352, 276, 265, 190, 0, 86, 96, 117, 70, 139, 68, 10, 48, 78, 40, 196, 15, 4, 0, 21, 7, 34, 20, 3, 21, 4, 9, 97, 55, 3, 26, 4, 0, 3, 28, 81, 85, 0, 19, 7, 3, 2, 0, 0, 0, 0, 0, 0, 3, 0, 23, 20, 2, 4, 5, 4, 0, 2, 7, 0, 11, 4, 0, 19, 0, 10, 0, 0, 0, 4, 9, 2, 7, 10, 11, 24, 1, …
|
| S2. |
a(n) = The n'th starting prime for which there are no solutions in S1.
2, 23, 83, 157, 181, 211, 223, 227, 229, 233, 239, 251, 283, 311, 331, 347, 353, 359, 367, 421, 431, 433, 439, 443, 461, 463, 467, 503, 521, 541, 547, 557, 577, 587, 593, 599, 601, 619, 631, 641, 647, 677, 683, 691, 701, 709, 719, 727, 733, 797, 809, 811, 821, …
|
| S3. |
a(n) = The n'th starting prime for which there is only one solution in S1.
419, 617, 827, 1097, 1187, 1229, 1487, 1531, 1609, 1669, 1811, 2143, 2243, 2251, 2311, 2539, 2677, 2693, 2707, 2713, 2819, 2953, 3203, 3221, 3539, …
|
Not bad for a morning's figuring. Time for a delicious breakfast of Hungry Jack pancakes! 
After breakfast I took Neya to the beach for a couple hours to let her paddle about. It was hot and sunny. We made sand castles and I showed her how to make turrets by dribbling wet sand. Later I enjoyed the sights (i.e. bikini-watching) while writing up day 1 of this record.
When Pat got back from the store we rented a paddleboat (4$ plus 20$ deposit for a half hour ride) and went out on the pond with Lynnea. These boats use pedals that you manipulate with your feet just like riding a bicycle which in turn drives paddlewheels under the boat.
Steering is accomplished (in theory) by means of a handle mounted front and center in the boat. Presumably this controls some sort of rudder beneath the craft. Pat and I quickly discovered that there was no “straight ahead” settings on this handle. The boat was always turning no matter where you placed the handle. Further there was a substantial delay between any change in handle position and any response from the craft. Not at all like driving a car. Eventually we found that we could approximate “straight ahead” by toggling the handle left and right as we paddled.
After a half hour in the boat we were overheated and exhausted. Pedaling in those things is hard work! Pat took Neya back to the camper and I went to the store to get Neya a pail and shovel to use on the beach tomorrow.
Dinner was a juicy steak seasoned with balsamic vinaigrette dressing in solitude. All of Pat's family went to a clam boil. I don't like boiled clam dinner so I stayed at the camper and relaxed with a little DOAX on the XBOX. Niceh spikuh!
Thursday night we had a very good campfire. Joyce (my mother in law) picked up a bag of kindling dowels. This gave me just what I needed to get a core with hot wood coals in it. Thanks Joyce!
My sisters in law Barbara and Kristina along with me, Patty, Lynnea, and my nieces Breanna and Samantha all toasted marshmallows. It was nice (and yummy!) 