(Again copied verbatim from a September 2009 thread I made.)
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$.
Following a comment, let's look at the $2×2$ case. I shall consider the case where all digits are distinct and to avoid issues with convention, nonzero.
Within these limits we select a set of four digits such as $\{1,2,3,4\}$. If each of the six two-element permutations generates a prime in either order, we have three primary magic squares apart from rotations and reflections (depending on which element is opposite a given one).
The set $\{1,2,3,4\}$ fails because $42$ and $24$ are both composite, and similarly there cannot be any two even digits, nor the digit $5$ (only two numbers in the 50s are prime and we would need three). We also cannot have two digits with residues $1,2\bmod 3$ or two multiples of $3$ (which lead to multiples of $3$), nor specifically $4$ together with $9$ (the odd number $49$ is $7×7$).
Here are the sets that work:
$\{1,3,4,7\}$
And that seems to be it! Thus three squares (plus trivial operations):
$\begin{array}&1&3\\4&7\end{array}$
$\begin{array}&1&4\\7&3\end{array}$
$\begin{array}&1&7\\3&4\end{array}$