# $n$ by $n$ Primally Magic Squares

A Primally Magic Square (PMS) is exactly like a traditional magic square with a change of criteria. Where a traditional magic square is one where the sum of each row, column, and both diagonals are some number, usually 15 (uses 1-9). By contrast, a PMS is one where all rows, columns, and both diagonals form a prime number. Note: if a number is prime either forward or back, it counts.

Example:

$\displaystyle \begin{matrix} 1 & 3 & 7 \\ 3 & 9 & 7 \\ 7 & 7 & 9 \end{matrix}$

137, 397, 977, 797, and 199 are all prime, so this square is a PMS.

How many 3x3 PMS's are there?

How many 4x4 PMS's are there?

How many 5x5 PMS's are there?

How many 9x9 PMS's are there?

Side note: Feel free to calculate the number of PMS's for some other $n$.

-
Why are you not interested in 6x6 through 8x8 PMSs? And what about 2x2? –  Matthew Conroy May 8 '11 at 20:58
Is it obvious that there is at least one PMS of each of those size? For 2 by 2 PMS, you can fill a square with ones for example. –  Joel Cohen May 8 '11 at 21:30
@Matthew: Feel free to calculate those too. :P @Joel: Given the increasing number of primes as $n$ increases, I think there should be at least one PMS. –  El'endia Starman May 8 '11 at 21:47
@ El'endia Starman : Doesn't the proportion of primes (among numbers with $n$ digits) decreases as $\frac{9}{n}$ asymptotically? –  Joel Cohen May 8 '11 at 22:28
@Joel: Yes, but the absolute number of primes increases, so that should compensate for the increasing difficulty of making a PMS. –  El'endia Starman May 8 '11 at 23:34