Next Article in Journal
Harnack Inequality for Self-Repelling Diffusions Driven by Subordinated Brownian Motion
Previous Article in Journal
Transformer-Based Downside Risk Forecasting: A Data-Driven Approach with Realized Downward Semi-Variance
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Prime Strictly Concentric Magic Squares of Odd Order

School of Computing and Mathematics, University of South Wales, Llantwit Rd, Pontypridd CF37 1DL, UK
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(8), 1261; https://doi.org/10.3390/math13081261
Submission received: 28 February 2025 / Revised: 8 April 2025 / Accepted: 9 April 2025 / Published: 11 April 2025
(This article belongs to the Section A: Algebra and Logic)

Abstract

:
Magic squares have been widely studied, with publications of mathematical interest dating back over 100 years. Most studies construct and analyse specific subsets of magic squares, with some exploring links to puzzles, number theory, and graph theory. The subset of magic squares this paper focuses on are those termed prime strictly concentric magic squares (PSCMS), and their general definitions, examples, and important properties are also presented. Previously, only the minimum centre cell values of PSCMS of odd order 5 to 19 were presented, by Makarova in 2015. In this paper, the corresponding list of primes for all minimum PSCMS of order 5 is given, and the number of minimum PSCMS of order 5 is enumerated.
MSC:
05A99; 05B99

1. Introduction

A magic square of order n is an n by n grid into which n 2 distinct integers are placed such that all rows, columns and diagonals sum to the same value, termed the magic constant. Magic squares can reportedly be traced back some 5000 years, and have been the subject of much research [1,2,3]. General magic squares are related to many other combinatorial structures, with Latin squares and Sudoku grids being the most obvious. Specifically, there is interest in the enumeration of magic squares. Normal magic squares, those containing the first n 2 ordinal numbers, have been enumerated up to order 5, with approximations for order 6 and higher orders [4,5,6]. There is also significant interest in the applications of magic squares to real world problems, particularly cryptography [7,8].
W. S. Andrews published extensively on magic squares, addressing both magic squares containing prime numbers exclusively (prime magic squares) and concentric magic squares (those having as their immediate centre subsquare a grid which itself conforms to the properties of a magic square, defined formally in Section 2). Andrews provides constructions and explores prime magic squares with the lowest possible magic constant [2,9,10]; in this paper, these will be termed minimum prime magic squares.
While much work in the literature has addressed concentric magic squares, most results presented concern normal magic squares. Such work offers constructions for squares of odd and even order [11,12]. Prime strictly concentric magic squares (PSCMS) have been addressed far less; one noteworthy PSCMS of order 13 was published in [13] without an explanation of the method of its construction.
This paper addresses PSCMS of odd order. The minimum centre cell values of PSCMS of odd order 5 to 19 were previously published [14]. In this paper, formal notation and structures are presented, leading to the full enumeration for the number of minimum PSCMS of order 5, those PSCMS that have the minimum centre cell value.
This paper begins with formal definitions and notations (Section 2) that are useful for subsequent explorations of this topic. In Section 3, the PSCMS properties required for their construction and enumeration are established. In Section 4, the minimum PSCMS is defined and an algorithm is provided for the generation of PSCMS of order 5, with the enumeration of the number of minimum PSCMS of order 5 being provided in Section 5.

2. Definitions and Notation

This section provides the definitions required to explain the properties of a PSCMS and to understand their construction. Where the properties of PSCMS of odd order and even order differ, only the odd-order definitions are provided, as only these will be required. The definition of a magic square is generally understood as presented in Reference [2].
Definition 1.
A magic square of order n is an n by n grid containing n 2 distinct integers positioned such that all rows, columns, and main diagonals sum to the same value, known as the magic constant. A normal magic square, NMS, contains integers 1 to n 2 . A prime magic square, PMS, contains n 2 distinct primes.
The position of the cell of a grid of order n at row i, i = 1 , , n , and column j, j = 1 , , n , is denoted ( i , j ) and has the value a i j .
Definition 2.
A centre subsquare of order m, m odd, of a magic square of order n, n odd, is composed of the centre m 2 cells of the magic square for  m = n 2 i , and i = 1 , , n 1 2 . The smallest such subsquare is of order 1. A magic centre subsquare of order m of a magic square of order n is a centre subsquare of order m, which is itself a magic square.
The centre subsquare of order 1 is here considered a trivial magic centre subsquare, but otherwise the concept of concentric magic squares given below follows that of Andrews [2].
Definition 3.
A magic square of order n, n 3 , for which its order ( n 2 ) centre subsquare is a magic centre subsquare, is termed a concentric magic square (CMS). A magic square of order n, n 5 and odd, is strictly concentric and denoted a SCMS, if each of its order n 2 i centre subsquares, i = 1 , , n 3 2 , is a CMS. A centre subsquare of order 3 is here considered a trivial SCMS. An SCMS containing n 2 distinct primes is denoted a PSCMS.
In the construction and enumeration of SCMS later in this paper, the concept of paired cells will be of importance due to the constraints on the values in such cells.
Definition 4.
For a SCMS of order n, n odd, a cell ( i , j ) has a paired cell ( i ¯ , j ¯ ) , such that
( i ¯ , j ¯ ) = ( n i + 1 , n i + 1 ) i = 1 , , n , i n + 1 2 , j = i ( 1 ) ( n i + 1 , i ) i = 1 , , n , i n + 1 2 , j = n i + 1 ( 2 ) ( i , n j + 1 ) i = 2 , , n 1 , j i , i + j n w h e n i > j a n d i + j n + 2 w h e n i < j ( 3 ) ( n i + 1 , j ) j = 2 , , n 1 , j i , i + j n w h e n j > i a n d i + j n + 2 w h e n j < i ( 4 )
Figure 1 illustrates the conditions of paired cells provided in Definition 4 for a SCMS of order 5.
Definition 5.
A SCMS of order n, n odd, and each of its centre subsquares, has a border comprising those cells which are adjacent to its respective outer edge. Let B n be the set of border cells of the SCMS of order n, and  B n 2 i be the set of border cells of its centre subsquares of order n 2 i , i = 1 , , n 3 2 . Let B n = B n 2 i , i = 0 , , n 3 2 .
B n denotes the set of all border cells for a SCMS of order n, n odd, and of the border cells of the nontrivial centre subsquares.
Definition 6.
A border pair ( a i j , a i ¯ j ¯ ) is a pair of values placed in cells in B n for a SCMS of order n, n odd, where ( i , j ) and ( i ¯ , j ¯ ) are paired cells. Let B n denote the set of all border pairs of the SCMS of order n.
Hence | B n | is the number of border pairs of the SCMS of order n.
Lemma 1.
The number of border pairs, | B n | , of a SCMS of order n, n odd, n 3 can be given as the recurrence | B n | = 2 ( n 1 ) + | B n 2 | , where | B 1 | is taken to be 0.
Proof. 
Let n = 3 , | B 3 | = 4 from observation, and satisfies the given recurrence. Assume the recurrence is true for some n = k , k > 3 and odd, | B k | = 2 ( k 1 ) + | B k 2 | . Now, consider the case n = k + 2 , for which 2 ( ( k + 2 ) 1 ) border pairs are added to B k ; hence, | B k + 2 | = 2 ( ( k + 2 ) 1 ) + | B k | . Through induction, the recurrence holds for any n odd.    □
From the recurrence the integer sequence obtained is A046092 [15], from the second term, commonly recognised as the four times triangular numbers, a ( x ) = 2 x ( x + 1 ) .
Theorem 1.
The number of border pairs, | B n | , of a SCMS of order n, n odd, n 3 is determined explicitly as | B n | = n 2 1 2 .
Proof. 
For j odd, j = ( 2 i + 1 ) , where i = 1 , , n 1 2 , the number of pairs for each border of an order j centre subsquare is | B j | = 2 ( j 1 ) . Hence, | B j | = 2 ( ( 2 i + 1 ) 1 ) = 4 i . Hence, | B n | = 4 i = 1 n 1 2 i = n 2 1 2 .    □

3. Properties of an SCMS

Makarova [16] observed the following relationship for which no proof is evident in the literature, which is therefore provided by the current authors.
Lemma 2.
A SCMS of order n, n odd, with centre cell value M having the magic constant S n = n M .
Proof. 
For n = 3 , the values in each column sum to the magic constant, S 3 , and so the following holds:
   
a 11 + a 21 + a 31 + a 13 + a 23 + a 33 = 2 S 3
Consider the pairs a 11 , a 33 and a 13 , a 31 , which form diagonals with a 22 , and likewise the pair a 21 , a 23 , which forms the centre row with a 22 ; these all sum to S 3 . As M = a 22 , then a 11 + a 33 = a 13 + a 31 = a 21 + a 23 = S 3 M .
Hence, 2 S 3 = 3 ( S 3 M ) and S 3 = 3 M . Assume that for some n = k , k > 3 and odd, S k = k M . Now, consider the case n = k + 2 . Using arguments similar to the case n = 3 , as the values in each column sum to the magic constant, S k + 2 , take the first and the ( k + 2 ) t h columns; then, a 11 + a ( k + 2 ) ( k + 2 ) + a ( k + 2 ) 1 + a 1 ( k + 2 ) + i = 2 k + 1 a i 1 + i = 2 k + 1 a i ( k + 2 ) = 2 S k + 2 . Consider the pairs a 11 , a ( k + 2 ) ( k + 2 ) and a ( k + 2 ) 1 , a 1 ( k + 2 ) , which form diagonals with cells in the centre subsquare of order k; these sum to S k + 2 . Likewise, the pairs a i 1 , a i ( k + 2 ) , i = 2 , , k + 1 , which form the centre rows with the centre subsquare of order k; these also all sum to S k + 2 . Since S k = k M , then a 11 + a ( k + 2 ) ( k + 2 ) = a ( k + 2 ) 1 + a 1 ( k + 2 ) = S k + 2 k M ; likewise, a i 1 + a i ( k + 2 ) = S k + 2 k M , i = 2 , , k + 1 . Hence, 2 S k + 2 = ( k + 2 ) ( S k + 2 k M ) , and therefore S k + 2 = ( k + 2 ) M . By induction, S n = n M for all n odd.    □
Lemma 3.
The elements of each border pair (Definition 6) of a SCMS of order n, n odd, sum to 2 M , where M is the centre cell value of the SCMS.
Proof. 
Consider a SCMS of order n, n > 3 , and odd. By Lemma 2 the SCMS has magic constant S n = n M . Removing the cells in B n and the corresponding border pair values in those cells yields a magic centre subsquare of order n 2 . The magic centre subsquare has the magic constant S n 2 = ( n 2 ) M = n M 2 M . Returning to the SCMS of order n, each row, column, and main diagonal contains one border pair, in the outer border; hence, the elements of each border pair must sum to 2 M . This holds for the magic square of order n = 3 , with a centre subsquare of n = 1 ; therefore, the lemma holds for all n odd.    □
This result establishes an important condition on the construction of SCMS, and hence PSCMS, from a magic centre subsquare, and will be used in the enumeration of PSCMS of order 5, following additional notation and consideration of permutation operations.
Definition 7.
Denote two values summing to 2 M , where M is the value of the centre cell of a SCMS, as a pair of complement values. Hence, all border pairs of a SCMS are pairs of complement values. Two prime numbers summing to 2 M are therefore denoted as a pair of complement primes. Hence, all border pairs of a PSCMS are pairs of complement primes.
The specific permutation operations in Table 1 may be performed on the outer border of the grid of order n, and on the borders of its centre subsquares. Let s denote the order of the grid or its centre subsquares, s = 3 , 5 , , n , s odd. When applying the permutation operations to the border of the grid or a centre subsquare of order s, consider the rows and columns of the border to be numbered 1 , , s . Note that the first two permutation operations may not be performed on the centre subsquare of order 3, since there is only a single non-corner border pair in each case.
Definition 8.
Two SCMS of order n with magic constant nM, n odd, are equivalent if one can be obtained from the other by undergoing specific permutations, as shown in Table 1. Otherwise, the magic squares are non-equivalent.
All the operations in Table 1 are feasible and each forms a group. P s is the group of symmetries involving cells in the border of order s; this is a semi-direct product of the groups listed in the rows of Table 1. The cardinality of the set of operations, P s , on each border of the SCMS is given by the product of the orders of each permutation operation in Table 1:
| P s | = 2 3 × [ ( s 2 ) ! ] 2
P is the total group of symmetries of a SCMS of order n, which is the following direct product:
P = P n × P n 2 × × P 3
P acts faithfully on the set of SCMS of order n. The cardinality of P is therefore
| P | = s = 3 , s odd n 2 3 × [ ( s 2 ) ! ] 2
Figure 2 shows two PSCMS that are equivalent, in which the grid in (a) of Figure 2 undergoes a permutation of the border pairs of the outer border in rows 2, 3, and 4 to form the grid in (b) of Figure 2.
Lemma 4.
In any PSCMS of order n, n odd, either every entry is congruent to 1 mod 6 , or every entry is congruent to 1 mod 6 .
Proof. 
All odd numbers can be written in the form ± 1 mod 6 or ± 3 mod 6 . Since all numbers of the form ± 3 mod 6 are divisible by 3, then, apart from 3 itself, none are prime numbers. Hence, all prime numbers greater than 3 can be written in the form ± 1 mod 6 . By Lemma 3 each border pair of a PSCMS of order n must sum to twice the centre cell value, which is itself of the form ± 1 mod 6 . If the centre cell is of the form 1 mod 6 then the border pairs must sum to 2 mod 6 ; hence, each value is of the form 1 mod 6 . The same argument holds if the centre cell is of the form 1 mod 6 . Hence, every entry must be of the same form as the centre cell value.    □
Corollary 1.
A PSCMS of order n, n odd, can never include the integer 3.
Proof. 
By Lemma 4, since 3 is neither of the form 6 k + 1 nor 6 k 1 , k N .    □
Having established the properties of PSCMS, this paper proceeds to detail their construction.

4. Minimum PSCMS of Order 5

A PSCMS of order 5 comprises a centre cell value, M, and twelve distinct border pairs of primes summing to 2M, four of which surround the centre cell forming the centre subsquare of order 3, and eight of which form the border of order 5. By Lemma 2, a PSCMS of order 5 has magic constant S 5 = 5 M .
Definition 9.
A PSCMS of order n, n odd, that has a minimum centre cell value, M, is termed a minimum PSCMS.
Lemma 5.
The minimum PSCMS of order 5 has a centre cell value of 251 and a magic constant of 1255.
Proof. 
Assume for contradiction that the centre cell value, M, is less than 251. To construct a PSCMS for which M < 251 and prime, there must exist at least twelve distinct pairs of complement primes x i , x ¯ i , such that x i + x ¯ i = 2 M , where x i , x ¯ i are the values in paired cells. Four of these pairs form the border pairs of the centre subsquare of order 3, and eight form the outer border pairs of the PSCMS of order 5. Only for M = 233 are there as many as twelve distinct pairs of complement primes. However, one of these pairs contains the integer `3’ which, from Corollary 1, cannot be in a PSCMS. It is known that a PSCMS of order 5 with centre cell value 251 exists. Hence, any PSCMS of order 5 with centre cell value 251 and a magic constant of 1255 is a minimum PSCMS.    □
The magic constant of a minimum PSCMS of order 5 is given in [14], without enumeration of the number of such PSCMS. A border of order 5 and the centre cell value are shown in Figure 3a, with one border pair shaded in grey, and its corresponding magic centre subsquare of order 3 is shown in Figure 3b.

Construction of Minimum PSCMS of Order 5

This section details the construction of the minimum PSCMS of order 5. Given the centre cell value M = 251 , there are thirteen pairs of complement primes satisfying Lemma 3, and there are exactly two possible non-equivalent magic centre subsquares of order 3, shown in Figure 4.
All minimum PSCMS of order 5 consist of a centre cell value and twelve pairs of complement primes formed from the following set of 26 prime numbers:
P = { 11 , 23 , 41 , 53 , 59 , 71 , 83 , 101 , 113 , 149 , 191 , 233 , 239 , 263 , 269 , 311 , 353 , 389 , 401 , 419 , 431 , 443 , 449 , 461 , 479 , 491 } .
For magic centre subsquare 1 (Figure 4a), six different combinations of the required eight pairs of complement primes, from  P , can be used to form a minimum PSCMS. For magic centre subsquare 2 (Figure 4b), nine different combinations of the required eight pairs of complement primes, from  P , can be used to form a minimum PSCMS. These different combinations were found by hand through an exhaustive search, are each referred to as a type, and are shown in Table 2.
In order to construct a PSCMS of order 5, first construct the magic centre subsquare of order 3. A PSCMS of order 3 for any given M (if one exists) can be generated using Algorithm 1.
Algorithm 1 Algorithm to form a PSCMS of order 3
  •          begin
  •          Input M and form P , the set of all primes that form pairs summing to 2 M .
  •          Place M into the centre of an empty grid of order 3.
  •          repeat
    •              Take a set of three distinct non-paired primes from P that sum to 3 M , to form a set S, and their complements to form a set S ¯ .
    •              Take a prime from P ( S S ¯ ) and call it T, and its complement T ¯ .
    •              repeat
      •                  Take an element x of S, and an element y of S ¯ that is not paired with x.
      •                  Let X be the sum of x , y and T
    •              until X = 3 M , or no further combinations of x , y are possible.
  •          until X = 3 M , or no further combinations of S are possible.
  •          if X = 3 M then
    •              begin
    •              Place x in ( 1 , 1 ) , y in ( 1 , 3 ) removing them from S and S ¯ , and place their complements in the paired cells, removing them from S ¯ and S.
    •              Place T in ( 1 , 2 ) and place T ¯ in ( 3 , 2 )
    •              Place the remaining element of S in ( 2 , 1 ) and place its complement from S ¯ in ( 2 , 3 ) .
    •              end
  •          else
    •              No PSCMS exists for the placed M.
  •          end if
  •          end
Algorithm 2 uses Algorithm 1 to form a centre subsquare of order 3, with the chosen M and P , before using a similar process to construct a PSCMS of order 5 around the given centre subsquare, if one exists.
Algorithm 2 Algorithm to form a PSCMS of order 5
  •          begin
  •          Input M and form P , the set of all primes that form pairs summing to 2 M .
  •          repeat
    •              Construct a PSCMS of order 3 with chosen M and P using Algorithm 1.
    •              Place the magic centre subsquare of order 3, with centre cell value M, into the centre of an empty grid of order 5.
    •              Form a set Q of the primes from P not used in the centre subsquare.
    •              repeat
      •                  Take a set of five distinct non-paired primes from Q that sum to 5 M , to form a set S, and their complements to form a set S ¯ .
      •                  Take a set of three distinct non-paired primes from Q ( S S ¯ ) to form a set T, and their complements to form a set T ¯ .
      •                  Repeat
        •                      Take an element x of S, and an element y of S ¯ that is not paired with x.
        •                      Let X be the sum of x , y and the elements of T.
      •                  until X = 5 M , or no further combinations of x , y are possible.
    •              until X = 5 M , or no further combinations of S are possible.
  •          until X = 5 M , or no further PSCMS of order 3 can be generated using Algorithm 1.
  •          if X = 5 M then
    •              begin
    •             Place x in ( 1 , 1 ) , y in ( 1 , 5 ) removing them from S and S ¯ , and place their complements in the paired cells, removing them from S ¯ and S.
    •              Place the elements of T in ( 1 , 2 ) , ( 1 , 3 ) , ( 1 , 4 ) in any order, and place their complements from T ¯ in the paired cells.
    •              Place the remaining elements of S in ( 2 , 1 ) , ( 3 , 1 ) , ( 4 , 1 ) in any order and place their complements from S ¯ in the paired cells.
    •              end
  •          else
    •              No PSCMS exists for the placed M.
  •          end if
  •          end
Theorem 2.
A minimum PSCMS of order 5 with centre cell value 251 is always formed using Algorithm 2 when magic centre subsquare 1 or 2 (shown in Figure 4) is placed in the centre of the grid.
Proof. 
For M = 251 , the set of complement primes (primes summing to 502) is
P = { 11 , 23 , 41 , 53 , 59 , 71 , 83 , 101 , 113 , 149 , 191 , 233 , 239 , 263 , 269 , 311 , 353 , 389 , 401 , 419 , 431 , 443 , 449 , 461 , 479 , 491 } .
Recall from Definition 7 that all border pairs are pairs of complement primes. Eight of these primes must be used in the centre subsquare and removed from P to form Q. In the case of subsquare 1,
Q = { 11 , 53 , 71 , 83 , 101 , 113 , 149 , 191 , 239 , 263 , 311 , 353 , 389 , 401 , 419 , 431 , 449 , 491 } ,
and in the case of subsquare 2,
Q = { 11 , 23 , 41 , 53 , 101 , 113 , 149 , 191 , 233 , 269 , 311 , 353 , 389 , 401 , 449 , 461 , 479 , 491 } .
In both cases | Q | = 18 , and Q consists of nine pairs of complement primes, of which eight pairs are needed to form the border of order 5.
It can easily be seen that five distinct pairs of complement primes satisfy conditions 1 and 3, below. From the remaining primes in Q it is easy to check that there will always be three more pairs of complement primes that can be chosen to satisfy conditions 2 and 4, below.
1. a11 + a12 + a13 + a14 + a15 = 1255
2. a11 + a21 + a31 + a41 + a51 = 1255
3. a51 + a52 + a53 + a54 + a55 = 1255
4. a15 + a25 + a35 + a45 + a55 = 1255.
The primes are placed in the manner specified in Algorithm 2 (with the centre subsquare of order 3 having been determined in line 4 through Algorithm 1, the paired values being determined in lines 7 to 15, and the border of the PSCMS of order 5 then being filled by lines 18 to 20). A minimum PSCMS is thereby formed. □
Thus, the two magic centre subsquares present in all minimum PSCMS of order 5 are established.

5. Enumeration of Minimum PSCMS of Order 5

Algorithm 2 and Table 1 and Table 2 are utilised to determine the number of minimum PSCMS of order 5. Each of the fifteen types is enumerated separately: firstly, in Section 5.1, the six types with magic centre subsquare 1 (shown in Figure 4a), and in Section 5.2 the nine types with magic centre subsquare 2 (shown in Figure 4b). Within each type, the primes listed in Table 2 are placed in pairs of complement sets, S and S ¯ from Algorithm 2. That is, the elements of each set sum to the required magic constant, and each element of each set is uniquely paired with a complement element in the other. A unique label is given to each such complement set pair. The possible pairs are shown in Table 3 and Table 4.

5.1. Enumeration with Magic Centre Subsquare 1

The squares are divided into types such that the types do not share the same list of prime numbers; therefore, a square of one type is non-equivalent to a square of another type. Recall that there are thirteen pairs of complement primes, and each type omits a different pair. Within each type, there are non-equivalent variants that use different pairs of complement sets. Using Table 1 and Equation (7), each variant can undergo | P | = | P 5 | | P 3 | = [ 8 × 36 ] [ 8 × 1 ] = 2304 permutations. Using these pairs, it is possible to construct all variants and then employ these to determine the number of PSCMS of each type.
Figure 5 shows examples of the placements of pairs of complement primes, using the pairs of complement sets of primes from Table 3, for grids of type 1A, around the magic centre subsquare of order 3, in order to form a PSCMS of order 5. This approach is consistent through all types, and hence no other such examples will be provided.
Lemma 6.
There are:
(i) 
  Three non-equivalent PSCMS of type 1A;
(ii) 
 Five non-equivalent PSCMS of type 1B;
(iii) 
Three non-equivalent PSCMS of type 1C;
(iv) 
Two non-equivalent PSCMS of type 1D;
(v) 
 Three non-equivalent PSCMS of type 1E;
(vi) 
Three non-equivalent PSCMS of type 1F.
Proof. 
In Case (i), given the primes shown in Table 2 for type 1A, there are five pairs of complement sets, as shown in Table 3, for magic centre subsquare 1 that satisfy the constraints 1 to 4 in the proof of Theorem 2; there are only three non-equivalent squares, which will be generated by Algorithm 2, shown in Figure 5. These squares are non-equivalent as the values in the corner cells are different, and hence the permutation operations in Table 1 cannot be applied to transform one to another.
In Case (ii), given the primes shown in Table 2 for type 1B, there are six pairs of complement sets, shown in Table 3, for magic centre subsquare 1 that satisfy the constraints 1 to 4 in the proof of Theorem 2; there are only five non-equivalent squares, which will be generated by Algorithm 2. These squares are non-equivalent as for each of the five, either the combination of paired cells in columns and rows 2, 3, and 4 differ, or the values in the corner cells are different, and hence the permutation operations in Table 1 cannot be applied to transform one to another.
Cases (iii), (iv), and (v) follow similarly to (i), with (iii) having six pairs of complement sets and three non-equivalent squares, (iv) having three pairs of complement sets and two non-equivalent squares, and (v) having four pairs of complement sets and three non-equivalent squares. Case (vi) follows similarly to (ii), with six pairs of complement sets and three non-equivalent squares. □
Lemma 7.
There are 19 non-equivalent minimum PSCMS of order 5 with magic centre subsquare 1.
Proof. 
This proof follows directly from Lemma 6. □
Theorem 3.
There are 43,776 minimum PSCMS of order 5 with magic centre subsquare 1.
Proof. 
This proof follows directly from Lemma 7 and Equation (7) since P acts faithfully on PSCMS; hence, | P 5 | | P 3 | × 19 = 43 , 776 . □

5.2. Enumeration with Magic Centre Subsquare 2

The squares are divided into non-equivalent types in the same manner as for centre subsquare 1 in Section 5.1. Table 4 shows the possible pairs of complement sets used in the construction of a minimum PSCMS with magic centre subsquare 2, as shown in Figure 4b.
Lemma 8.
There are:
(i) 
    Two non-equivalent PSCMS of type 2A;
(ii) 
   Three non-equivalent PSCMS of type 2B;
(iii) 
  Two non-equivalent PSCMS of type 2C;
(iv) 
  Two non-equivalent PSCMS of type 2D;
(v) 
   One PSCMS, modulo the action of P , of type 2E;
(vi) 
  One PSCMS, modulo the action of P , of type 2F;
(vii) 
 Two non-equivalent PSCMS of type 2G;
(viii) 
Two non-equivalent PSCMS of type 2H;
(ix) 
  One PSCMS, modulo the action of P , of type 2I.
Proof. 
Cases (i), (iii), (iv), (vii), and (viii) follow similarly to case (i) in Lemma 6, with (i), (iii), and (iv) each having four pairs of complement sets and two non-equivalent squares, and (vii) and (viii) each having three pairs of complement sets and two non-equivalent squares. Case (ii) follows similarly to case (ii) in Lemma 6, with six pairs of complement sets and three non-equivalent squares. Cases (v), (vi), and (ix) have only two pairs of complement sets, and therefore just one square. □
Lemma 9.
There are 16 non-equivalent minimum PSCMS of order 5 with magic centre subsquare 2.
Proof. 
This proof follows directly from Lemma 8. □
Theorem 4.
There are 36,864 minimum PSCMS of order 5 with magic centre subsquare 2.
Proof. 
This proof follows directly from Lemma 9 and Equation (7), since P acts faithfully on PSCMS; hence, | P 5 | | P 3 | × 16 = 36 , 864 . □
Lemma 10.
There are 35 non-equivalent minimum PSCMS of order 5.
Proof. 
This proof follows directly from Lemmas 7 and 9. □
Theorem 5.
There are 80,640 minimum PSCMS of order 5; these have magic constant 1255.
Proof. 
This proof follows directly from Theorems 3 and 4. □

6. Conclusions

It has been determined that there exist 35 non-equivalent minimum PSCMS of order 5, and these have magic constant 1255. Hence, there exist 80,640 minimum PSCMS of order 5.
For PSCMS of higher order, the value of M is larger, and hence there are more pairs of complement primes summing to 2 M . This results in a greatly increased number of valid magic centre subsquares of order 3, and hence the enumeration becomes more complex. In addition, Algorithm 2 requires the additional nesting of loops for further borders around the magic centre subsquare. These points highlight that, as with the analysis of other structures, such as Latin Squares, the enumeration of higher-order grids becomes more of a computational, rather than a combinatorial, problem. For context, it is worth noting that there is only one distinct NMS of order 3 and 880 distinct NMS of order 4 [5], but 275,305,224 distinct NMS of order 5 [17]. Until recently, only stochastic estimates for the number of distinct order 6 NMS were presented, but in 2024 the number 17,753,889,197,660,635,632 was provided [18], determined through about 80,000 h of Nvidia GeForce RTX-4090 GPUs over a period of about six months; a second enumeration to check this result took a similar amount of processing power.
The completability of partial grids has been explored for other combinatorial structures, notably Latin Squares and Sudoku grids, providing one route for exploring SCMS and PSCMS in greater depth. It would be interesting to explore the links of PSCMS to these combinatorial structures, which have many applications, including in Coding Theory, Cryptography, and Experimental Design. Another open problem is to consider the links between PSCMS and Graph Labelling, and their applications.

Author Contributions

Conceptualization, S.P. and P.A.R.; methodology, A.L.S., S.P. and P.A.R.; software, A.S and P.A.R.; validation, S.P. and P.A.R.; formal analysis, A.L.S., S.P. and P.A.R.; investigation, A.L.S.; writing—original draft preparation, A.L.S.; writing—review and editing, S.P. and P.A.R.; visualization, A.L.S., S.P. and P.A.R.; supervision, S.P. and P.A.R.; project administration, S.P. and P.A.R. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data is contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
MDPIMultidisciplinary Digital Publishing Institute
DOAJDirectory of open access journals
NMSNormal Magic Square
SCMSStrictly Concentric Magic Square
PSCMSPrime Strictly Concentric Magic Square

References

  1. Ahmed, M.; Loera, J.D.; Hemmecke, R. Polyhedral Cones of Magic Cubes and Squares. In Discrete and Computational Geometry; Springer: Berlin/Heidelberg, Germany, 2003; pp. 25–41. [Google Scholar]
  2. Andrews, W.S. Magic Squares and Cubes, 2nd ed.; Dover: New York, NY, USA, 1960. [Google Scholar]
  3. Henrich, C.J. Magic Squares and Linear Algebra. Am. Math. Mon. 1991, 98, 481–488. [Google Scholar] [CrossRef]
  4. Beck, M.; Herick, A.V. Enumeration of 4 × 4 Magic Squares. Math. Comput. 2011, 80, 617–621. [Google Scholar] [CrossRef]
  5. Ollerenshaw, K.; Bondi, H. Magic Squares of Order Four. Philos. Trans. R. Soc. Lond. 1982, 306, 443–494. [Google Scholar]
  6. Pinn, K.; Wieczerkowski, C. Number of Magic Squares from Parallel Tempering Monte Carlo. Int. J. Mod. Phys. Comput. Phys. Phys. Comput. 1998, 9, 541–546. [Google Scholar] [CrossRef]
  7. Lok, Y.W.; Chin, K.Y. An Application of Magic Squares in Cryptography. 2018. Available online: https://www.academia.edu/37853557/An_Application_of_Magic_Squares_in_Cryptography (accessed on 8 April 2025).
  8. Rani, N.; Mishra, V. Application of Magic Squares in Cryptography. In Proceedings in Adaptation, Learning and Optimization, Proceedings of the International Conference on Intelligent Vision and Computing (ICIVC 2021); Sharma, H., Vyas, V.K., Pandey, R.K., Prasad, M., Eds.; Springer: Cham, Switzerland, 2021; Volume 15. [Google Scholar] [CrossRef]
  9. Andrews, W.S.; Sayles, H.A. Magic Squares made with Prime Numbers to have the lowest possible summations. Monist 1913, 23, 623–630. [Google Scholar]
  10. Andrews, W.S. Magic squares (conclusion). Monist 1905, 15, 555–586. [Google Scholar] [CrossRef]
  11. Das, M.K. On concentric magic squares and magic squares of order 4n + 2. Int. J. Math. Educ. Sci. Technol. 1991, 22, 187–201. [Google Scholar] [CrossRef]
  12. Cammann, S. Islamic and Indian Magic Squares: Part I. Hist. Relig. 1969, 8, 181–209. [Google Scholar] [CrossRef]
  13. Madachy, J.S. Mathematics on Vacation; Thomas Nelson & Sons Ltd.: Nashville, TN, USA, 1966. [Google Scholar]
  14. Makarova, N. Concentric Magic Squares of Primes. Primes Magic Games. Available online: http://primesmagicgames.altervista.org/wp/forums/topic/concentric-magic-squares-of-primes/ (accessed on 24 January 2025).
  15. Sloane, N.J.A.; Weisstein, E.W. A046092. The Online Encyclopedia of Integer Sequences. Available online: http://oeis.org/A046092 (accessed on 7 October 2020).
  16. Makarova, N. Personal Communication. 2018. [Google Scholar]
  17. Loly, P.; Cameron, I.; Trump, W.; Schindel, D. Magic Square Spectra. Linear Algebra Its Appl. 2009, 430, 2659–2680. [Google Scholar] [CrossRef]
  18. Mino, H. The Number of Magic Squares of Order Six Counted up to Rotations and Reflections. Available online: https://magicsquare6.net/doku.php?id=magicsquare6 (accessed on 6 April 2025).
Figure 1. Illustration of paired cells for a SCMS of order 5; the cell numbers relate to the equation numbers given in Definition 4, followed by a letter denoting pairings.
Figure 1. Illustration of paired cells for a SCMS of order 5; the cell numbers relate to the equation numbers given in Definition 4, followed by a letter denoting pairings.
Mathematics 13 01261 g001
Figure 2. Two equivalent PSCMS of order 5. (a) A PSCMS; (b) PSCMS equivalent to (a).
Figure 2. Two equivalent PSCMS of order 5. (a) A PSCMS; (b) PSCMS equivalent to (a).
Mathematics 13 01261 g002
Figure 3. Border and magic centre subsquare of order 3 for a minimum PSCMS of order 5. (a) Border of a minimum PSCMS of order 5 with center cell value 251; (b) magic centre subsquare of order 3 for a minimum PSCMS of order 5.
Figure 3. Border and magic centre subsquare of order 3 for a minimum PSCMS of order 5. (a) Border of a minimum PSCMS of order 5 with center cell value 251; (b) magic centre subsquare of order 3 for a minimum PSCMS of order 5.
Mathematics 13 01261 g003
Figure 4. The two non-equivalent magic centre subsquares of order 3 for a minimum PSCMS of order 5. (a) Magic centre subsquare 1; (b) magic centre subsquare 2.
Figure 4. The two non-equivalent magic centre subsquares of order 3 for a minimum PSCMS of order 5. (a) Magic centre subsquare 1; (b) magic centre subsquare 2.
Mathematics 13 01261 g004
Figure 5. Three borders for a type 1A minimum PSCMS. (a) Order 5 type 1A using A1 and A2; (b) order 5 type 1A using A1 and A3; (c) order 5 type 1A using A4 and A5.
Figure 5. Three borders for a type 1A minimum PSCMS. (a) Order 5 type 1A using A1 and A2; (b) order 5 type 1A using A1 and A3; (c) order 5 type 1A using A4 and A5.
Mathematics 13 01261 g005
Table 1. Permutation operations on the border pairs in cells of a SCMS of order n, n odd, where the permutation order is the smallest number of such permutations required to return to the initial state.
Table 1. Permutation operations on the border pairs in cells of a SCMS of order n, n odd, where the permutation order is the smallest number of such permutations required to return to the initial state.
PermutationOrder
Permute the border pairs in columns i, i 1 and i s ,
noting that the values remain in their original row ( s 2 ) !
Permute the border pairs in rows i, i 1 and i s ,
noting that the values remain in their original column ( s 2 ) !
Permute the value in ( 1 , j ) with the value in ( s , j )
for all j = 1 , , s 2
Permute the value in ( i , 1 ) with the value in ( i , s )
for all i = 1 , , s 2
Permute the value in ( 1 , j ) with the value in ( i , s )
and the value in ( s , j ) with the value in ( i , 1 )
for all i = 1 , , s where i = s j + 1 2
Table 2. Primes used in B 5 of the minimum PSCMS of order 5 with magic centre subsquares 1 and 2.
Table 2. Primes used in B 5 of the minimum PSCMS of order 5 with magic centre subsquares 1 and 2.
TypeList of Primes in the Border of Order 5
1A11, 53, 71, 83, 101, 113, 191, 239, 263, 311, 389, 401, 419, 431, 449, 491
1B11, 53, 83, 101, 113, 149, 191, 239, 263, 311, 353, 389, 401, 419, 449, 491
1C11, 71, 83, 101, 113, 149, 191, 239, 263, 311, 353, 389, 401, 419, 431, 491
1D53, 71, 83, 101, 113, 149, 191, 239, 263, 311, 353, 389, 401, 419, 431, 449
1E11, 53, 71, 83, 101, 113, 149, 239, 263, 353, 389, 401, 419, 431, 449, 491
1F11, 53, 71, 83, 101, 149, 191, 239, 263, 311, 353, 401, 419, 431, 449, 491
2A11, 23, 41, 53, 101, 113, 149, 191, 311, 353, 389, 401, 449, 461, 479, 491
2B11, 23, 41, 53, 101, 113, 149, 233, 269, 353, 389, 401, 449, 461, 479, 491
2C11, 23, 41, 53, 101, 113, 191, 233, 269, 311, 389, 401, 449, 461, 479, 491
2D11, 23, 41, 101, 113, 149, 191, 233, 269, 311, 353, 389, 401, 461, 479, 491
2E11, 23, 41, 53, 101, 149, 191, 233, 269, 311, 353, 401, 449, 461, 479, 491
2F11, 23, 41, 53, 113, 149, 191, 233, 269, 311, 353, 389, 449, 461, 479, 491
2G11, 23, 53, 101, 113, 149, 191, 233, 269, 311, 353, 389, 401, 449, 479, 491
2H11, 41, 53, 101, 113, 149, 191, 233, 269, 311, 353, 389, 401, 449, 461, 491
2I23, 41, 53, 101, 113, 149, 191, 233, 269, 311, 353, 389, 401, 449, 461, 479
Table 3. Pairs of complement sets of primes, S and S ¯ , assigned to B 5 of the minimum PSCMS with magic centre subsquare 1.
Table 3. Pairs of complement sets of primes, S and S ¯ , assigned to B 5 of the minimum PSCMS with magic centre subsquare 1.
TypeLabelsPairs of Complement Sets, S and S ¯
1AA1{53,  71, 311, 401, 419}, { 83, 101, 191, 431, 449}
A2{11, 113, 263, 419, 449}, { 53,  83, 239, 389, 491}
A3{11, 191, 263, 389, 401}, {101, 113, 239, 311, 491}
A4{53,  71, 239, 401, 491}, { 11, 101, 263, 431, 449}
A5{11, 113, 311, 401, 419}, { 83, 101, 191, 389, 491}
1BB1{ 53, 191, 239, 353, 419}, { 83, 149, 263, 311, 449}
B2{ 11, 191, 263, 389, 401}, {101, 113, 239, 311, 491}
B3{ 83, 101, 191, 389, 491}, { 11, 113, 311, 401, 419}
B4{ 53, 149, 263, 389, 401}, {101, 113, 239, 353, 449}
B5{ 53, 101, 191, 419, 491}, { 11,  83, 311, 401, 449}
B6{113, 149, 263, 311, 419}, { 83, 191, 239, 353, 389}
1CC1{ 11,  71, 353, 401, 419}, { 83, 101, 149, 431, 491}
C2{ 83, 191, 239, 353, 389}, {113, 149, 263, 311, 419}
C3{ 11, 113, 311, 401, 419}, { 83, 101, 191, 389, 491}
C4{101, 149, 263, 311, 431}, { 71, 191, 239, 353, 401}
C5{ 11, 149, 263, 401, 431}, { 71, 101, 239, 353, 491}
C6{101, 113, 191, 419, 431}, { 71,  83, 311, 389, 401}
1DD1{ 53, 113, 239, 419, 431}, { 71,  83, 263, 389, 449}
D2{ 71, 101, 311, 353, 419}, { 83, 149, 191, 401, 431}
D3{ 71, 191, 239, 353, 401}, {101, 149, 263, 311, 431}
1EE1{ 11,  71, 353, 401, 419}, {83, 101, 149, 431, 491}
E2{101, 113, 239, 353, 449}, {53, 149, 263, 389, 401}
E3{ 71,  83, 263, 389, 449}, {53, 113, 239, 419, 431}
E4{ 11, 149, 263, 401, 431}, {71, 101, 239, 353, 491}
1FF1{ 53, 101, 191, 419, 491}, {11,  83, 311, 401, 449}
F2{101, 149, 263, 311, 431}, {71, 191, 239, 353, 401}
F3{ 11, 101, 263, 431, 449}, {53,  71, 239, 401, 491}
F4{ 71, 101, 311, 353, 419}, {83, 149, 191, 401, 431}
F5{ 11, 149, 263, 401, 431}, {71, 101, 239, 353, 491}
F6{ 53,  71, 311, 401, 419}, {83, 101, 191, 431, 449}
Table 4. Pairs of complement sets of primes, S and S ¯ , assigned to B 5 of the minimum PSCMS with magic centre subsquare 2.
Table 4. Pairs of complement sets of primes, S and S ¯ , assigned to B 5 of the minimum PSCMS with magic centre subsquare 2.
TypeLabelsPairs of Complement Sets, S and S ¯
2AA1{ 11,  41, 353, 401, 449}, { 53, 101, 149, 461, 491}
A2{ 11, 113, 191, 461, 479}, { 23,  41, 311, 389, 491}
A3{ 11, 101, 311, 353, 479}, { 23, 149, 191, 401, 491}
A4{ 23,  41, 353, 389, 449}, { 53, 113, 149, 461, 479}
2BB1{ 11, 101, 233, 449, 461}, { 41,  53, 269, 401, 491}
B2{ 23,  41, 353, 389, 449}, { 53, 113, 149, 461, 479}
B3{ 11, 113, 269, 401, 461}, { 41, 101, 233, 389, 491}
B4{ 53, 101, 269, 353, 479}, { 23, 149, 233, 401, 449}
B5{ 11, 149, 233, 401, 461}, { 41, 101, 269, 353, 491}
B6{ 23, 113, 269, 401, 449}, { 53, 101, 233, 389, 479}
2CC1{ 11,  53, 311, 401, 479}, { 23, 101, 191, 449, 491}
C2{101, 113, 269, 311, 461}, { 41, 191, 233, 389, 401}
C3{ 11, 113, 191, 461, 479}, { 23,  41, 311, 389, 491}
C4{ 23, 113, 269, 401, 449}, { 53, 101, 233, 389, 479}
2DD1{ 11, 101, 311, 353, 479}, { 23, 149, 191, 401, 491}
D2{ 11, 113, 269, 401, 461}, { 41, 101, 233, 389, 491}
D3{ 11, 113, 191, 461, 479}, { 23,  41, 311, 389, 491}
D4{ 41, 191, 269, 353, 401}, {101, 149, 233, 311, 461}
2EE1{ 11,  53, 311, 401, 479}, { 23, 101, 191, 449, 491}
E2{101, 149, 233, 311, 461}, { 41, 191, 269, 353, 401}
2FF1{ 11, 113, 191, 461, 479}, { 23,  41, 311, 389, 491}
F2{113, 149, 233, 311, 449}, { 53, 191, 269, 353, 389}
2GG1{ 11,  53, 311, 401, 479}, { 23, 101, 191, 449, 491}
G2{ 53, 191, 269, 353, 389}, {113, 149, 233, 311, 449}
G3{ 11, 101, 311, 353, 479}, { 23, 149, 191, 401, 491}
2HH1{ 11,  41, 353, 401, 449}, { 53, 101, 149, 461, 491}
H2{ 53, 191, 269, 353, 389}, {113, 149, 233, 311, 449}
H3{ 11, 113, 269, 401, 461}, { 41, 101, 233, 389, 491}
2II1{ 23, 113, 269, 401, 449}, { 53, 101, 233, 389, 479}
I2{ 53, 149, 191, 401, 461}, { 41, 101, 311, 353, 449}
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Skelt, A.L.; Perkins, S.; Roach, P.A. Prime Strictly Concentric Magic Squares of Odd Order. Mathematics 2025, 13, 1261. https://doi.org/10.3390/math13081261

AMA Style

Skelt AL, Perkins S, Roach PA. Prime Strictly Concentric Magic Squares of Odd Order. Mathematics. 2025; 13(8):1261. https://doi.org/10.3390/math13081261

Chicago/Turabian Style

Skelt, Anna Louise, Stephanie Perkins, and Paul Alun Roach. 2025. "Prime Strictly Concentric Magic Squares of Odd Order" Mathematics 13, no. 8: 1261. https://doi.org/10.3390/math13081261

APA Style

Skelt, A. L., Perkins, S., & Roach, P. A. (2025). Prime Strictly Concentric Magic Squares of Odd Order. Mathematics, 13(8), 1261. https://doi.org/10.3390/math13081261

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop