Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pandiagonal magic square
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Magic square with extra constraints}} A '''pandiagonal magic square''' or '''panmagic square''' (also '''diabolic square''', '''diabolical square''' or '''diabolical magic square''') is a [[magic square]] with the additional property that the [[broken diagonal]]s, i.e. the diagonals that wrap round at the edges of the square, also add up to the [[magic constant]]. A pandiagonal magic square remains pandiagonally magic not only under [[Rotation (mathematics)|rotation]] or [[Reflection (mathematics)|reflection]], but also if a row or column is [[Translation (geometry)|moved]] from one side of the square to the opposite side. As such, an <math>n \times n</math> pandiagonal magic square can be regarded as having <math>8n^2</math> orientations. ==3×3 pandiagonal magic squares== It can be shown that [[Triviality (mathematics)|non-trivial]] pandiagonal magic squares of order 3 do not exist. Suppose the square :<math>\begin{array}{|c|c|c|} \hline \!\!\!\; a_{11} \!\!\! & \!\! a_{12}\!\!\!\!\; & \!\! a_{13} \!\!\\ \hline \!\!\!\; a_{21} \!\!\! & \!\! a_{22}\!\!\!\!\; & \!\! a_{23} \!\!\\ \hline \!\!\!\; a_{31} \!\!\! & \!\! a_{32}\!\!\!\!\; & \!\! a_{33} \!\!\\ \hline \end{array}</math> is pandiagonally magic with magic constant {{tmath|s}}. Adding sums {{tmath|a_{11} + a_{22} + a_{33},}} {{tmath|a_{12} + a_{22} + a_{32},}} and {{tmath|a_{13} + a_{22} + a_{31} }} results in {{tmath|3s}}. Subtracting {{tmath|a_{11} + a_{12} + a_{13} }} and {{tmath|a_{31} + a_{32} + a_{33},}} we get {{tmath|1=3a_{22} = s}} However, if we move the third column in front and perform the same argument, we obtain {{tmath|1=3a_{21} = s}}. In fact, using the [[Symmetry in mathematics|symmetries]] of 3 × 3 magic squares, all cells must equal {{tmath|\tfrac{1}{3}s}}. Therefore, all 3 × 3 pandiagonal magic squares must be trivial. However, if the magic square concept is generalized to include geometric shapes instead of numbers – the [[geometric magic square]]s discovered by [[Lee Sallows]] – a 3 × 3 pandiagonal magic square does exist. ==4×4 pandiagonal magic squares== [[File:4x4_magic_square_hierarchy.svg|thumb|upright|[[Euler diagram]] of properties of some types of 4{{times}}4 magic squares. Cells of the same colour sum to the magic constant.]] The smallest non-trivial pandiagonal magic squares are 4{{times}}4 squares. All 4{{times}}4 pandiagonal magic squares must be [[translational symmetry|translationally symmetric]] to the form<ref>{{cite web | url = https://matthbeck.github.io/teach/masters/louis.pdf | title = Magic Counting with Inside-Out Polytopes | date = May 13, 2018 | first = Louis | last = Ng}}</ref> {|class="wikitable" style="margin-left: auto; margin-right: auto; border: none; text-align:center; width:27em; height:27em; table-layout:fixed;" |- | ''a'' || ''a''+''b''+''c''+''e'' || ''a''+''c''+''d'' || ''a''+''b''+''d''+''e'' |- | ''a''+''b''+''c''+''d'' || ''a''+''d''+''e'' || ''a''+''b'' || ''a''+''c''+''e'' |- | ''a''+''b''+''e'' || ''a''+''c'' || ''a''+''b''+''c''+''d''+''e'' || ''a''+''d'' |- | ''a''+''c''+''d''+''e'' || ''a''+''b''+''d'' || ''a''+''e'' || ''a''+''b''+''c'' |} Since each 2{{times}}2 subsquare sums to the magic constant, 4{{times}}4 pandiagonal magic squares are [[most-perfect magic square]]s. In addition, the two numbers at the opposite corners of any 3{{times}}3 square add up to half the magic constant. Consequently, all 4{{times}}4 pandiagonal magic squares that are [[associative magic square|associative]] must have duplicate cells. All 4{{times}}4 pandiagonal magic squares using numbers 1-16 without duplicates are obtained by letting {{mvar|a}} equal 1; letting {{mvar|b}}, {{mvar|c}}, {{mvar|d}}, and {{mvar|e}} equal 1, 2, 4, and 8 in some order; and applying some [[translation (geometry)|translation]]. For example, with {{math|1=''b'' = 1}}, {{math|1=''c'' = 2}}, {{math|1=''d'' = 4}}, and {{math|1=''e'' = 8}}, we have the magic square {|class="wikitable" style="margin-left: auto; margin-right: auto; border: none; text-align:center; text-align:center; width:8em; height:8em; table-layout:fixed;" |- | 1 || 12 || 7 || 14 |- | 8 || 13 || 2 || 11 |- | 10 || 3 || 16 || 5 |- | 15 || 6 || 9 || 4 |} The number of 4{{times}}4 pandiagonal magic squares using numbers 1-16 without duplicates is 384 (16 times 24, where 16 accounts for the translation and 24 accounts for the 4[[factorial|!]] ways to assign 1, 2, 4, and 8 to {{mvar|b}}, {{mvar|c}}, {{mvar|d}}, and {{mvar|e}}). ==5×5 pandiagonal magic squares== There are many 5 × 5 pandiagonal magic squares. Unlike 4 × 4 pandiagonal magic squares, these can be [[associative magic square|associative]]. The following is a 5 × 5 associative pandiagonal magic square: {|class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:10em;height:10em;table-layout:fixed;" |- | 20 || 8 || 21 || 14 || 2 |- | 11 || 4 || 17 || 10 || 23 |- | 7 || 25 || 13 || 1 || 19 |- | 3 || 16 || 9 || 22 || 15 |- | 24 || 12 || 5 || 18 || 6 |} In addition to the rows, columns, and diagonals, a 5 × 5 pandiagonal magic square also shows its magic constant in four "[[quincunx]]" patterns, which in the above example are: : 17+25+13+1+9 = 65 (center plus adjacent row and column squares) : 21+7+13+19+5 = 65 (center plus the remaining row and column squares) : 4+10+13+16+22 = 65 (center plus diagonally adjacent squares) : 20+2+13+24+6 = 65 (center plus the remaining squares on its diagonals) Each of these quincunxes can be translated to other positions in the square by [[cyclic permutation]] of the rows and columns (wrapping around), which in a pandiagonal magic square does not affect the equality of the magic constants. This leads to 100 quincunx sums, including broken quincunxes analogous to broken diagonals. The quincunx sums can be proved by taking [[linear combination]]s of the row, column, and diagonal sums. Consider the pandiagonal magic square :<math>\begin{array}{|c|c|c|c|c|} \hline \!\!\!\; a_{11} \!\!\! & \!\! a_{12} \!\!\! & \!\! a_{13} \!\!\! & \!\! a_{14} \!\!\! & \!\! a_{15} \!\!\\ \hline \!\!\!\; a_{21} \!\!\! & \!\! a_{22} \!\!\! & \!\! a_{23} \!\!\! & \!\! a_{24} \!\!\! & \!\! a_{25} \!\!\\ \hline \!\!\!\; a_{31} \!\!\! & \!\! a_{32} \!\!\! & \!\! a_{33} \!\!\! & \!\! a_{34} \!\!\! & \!\! a_{35} \!\!\\ \hline \!\!\!\; a_{41} \!\!\! & \!\! a_{42} \!\!\! & \!\! a_{43} \!\!\! & \!\! a_{44} \!\!\! & \!\! a_{45} \!\!\\ \hline \!\!\!\; a_{51} \!\!\! & \!\! a_{52} \!\!\! & \!\! a_{53} \!\!\! & \!\! a_{54} \!\!\! & \!\! a_{55} \!\!\\ \hline \end{array}</math> with magic constant {{mvar|s}}. To prove the quincunx sum <math>a_{11} + a_{15} + a_{33} + a_{51} + a_{55} = s</math> (corresponding to the 20+2+13+24+6 = 65 example given above), we can add together the following: : 3 times each of the diagonal sums <math>a_{11} + a_{22} + a_{33} + a_{44} + a_{55}</math> and <math>a_{15} + a_{24} + a_{33} + a_{42} + a_{51}</math>, : The diagonal sums <math>a_{11} + a_{25} + a_{34} + a_{43} + a_{52}</math>, <math>a_{12} + a_{23} + a_{34} + a_{45} + a_{51}</math>, <math>a_{14} + a_{23} + a_{32} + a_{41} + a_{55}</math>, and <math>a_{15} + a_{21} + a_{32} + a_{43} + a_{54}</math>, : The row sums <math>a_{11} + a_{12} + a_{13} + a_{14} + a_{15}</math> and <math>a_{51} + a_{52} + a_{53} + a_{54} + a_{55}</math>. From this sum, subtract the following: : The row sums <math>a_{21} + a_{22} + a_{23} + a_{24} + a_{25}</math> and <math>a_{41} + a_{42} + a_{43} + a_{44} + a_{45}</math>, : The column sum <math>a_{13} + a_{23} + a_{33} + a_{43} + a_{53}</math>, : Twice each of the column sums <math>a_{12} + a_{22} + a_{32} + a_{42} + a_{52}</math> and <math>a_{14} + a_{24} + a_{34} + a_{44} + a_{54}</math>. The net result is <math>5a_{11} + 5a_{15} + 5a_{33} + 5a_{51} + 5a_{55} = 5s</math>, which divided by 5 gives the quincunx sum. Similar linear combinations can be constructed for the other quincunx patterns <math>a_{23} + a_{32} + a_{33} + a_{34} + a_{43}</math>, <math>a_{13} + a_{31} + a_{33} + a_{35} + a_{53}</math>, and <math>a_{22} + a_{24} + a_{33} + a_{42} + a_{44}</math>. == (4''n''+2)×(4''n''+2) pandiagonal magic squares with nonconsecutive elements == No pandiagonal magic square exists of order <math>4n+2</math> if consecutive [[integer]]s are used. But certain sequences of nonconsecutive integers do admit order-(<math>4n+2</math>) pandiagonal magic squares. Consider the sum 1+2+3+5+6+7 = 24. This sum can be divided in half by taking the appropriate groups of three addends, or in thirds using groups of two addends: : 1+5+6 = 2+3+7 = 12 : 1+7 = 2+6 = 3+5 = 8 An additional equal partitioning of the sum of squares guarantees the semi-bimagic property noted below: : 1<sup>2</sup> + 5<sup>2</sup> + 6<sup>2</sup> = 2<sup>2</sup> + 3<sup>2</sup> + 7<sup>2</sup> = 62 Note that the consecutive integer sum 1+2+3+4+5+6 = 21, an [[parity (mathematics)|odd]] sum, lacks the half-partitioning. With both equal partitions available, the numbers 1, 2, 3, 5, 6, 7 can be arranged into 6 × 6 pandigonal patterns {{mvar|A}} and {{mvar|B}}, respectively given by: {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:12em;height:12em;table-layout:fixed;" |- | 1 || 5 || 6 || 7 || 3 || 2 |- | 5 || 6 || 1 || 3 || 2 || 7 |- | 6 || 1 || 5 || 2 || 7 || 3 |- | 1 || 5 || 6 || 7 || 3 || 2 |- | 5 || 6 || 1 || 3 || 2 || 7 |- | 6 || 1 || 5 || 2 || 7 || 3 |} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:12em;height:12em;table-layout:fixed;" | 6 || 5 || 1 || 6 || 5 || 1 |- | 1 || 6 || 5 || 1 || 6 || 5 |- | 5 || 1 || 6 || 5 || 1 || 6 |- | 2 || 3 || 7 || 2 || 3 || 7 |- | 7 || 2 || 3 || 7 || 2 || 3 |- | 3 || 7 || 2 || 3 || 7 || 2 |} Then <math>7A + B - 7C</math> (where {{mvar|C}} is the magic square with 1 for all cells) gives the nonconsecutive pandiagonal 6 × 6 square: {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:12em;height:12em;table-layout:fixed;" |- | 6 || 33 || 36 || 48 || 19 || 8 |- | 29 || 41 || 5 || 15 || 13 || 47 |- | 40 || 1 || 34 || 12 || 43 || 20 |- | 2 || 31 || 42 || 44 || 17 || 14 |- | 35 || 37 || 3 || 21 || 9 || 45 |- | 38 || 7 || 30 || 10 || 49 || 16 |} with a maximum element of 49 and a pandiagonal magic constant of 150. This square is pandiagonal and semi-bimagic, that means that rows, columns, main diagonals and broken diagonals have a sum of 150 and, if we square all the numbers in the square, only the rows and the columns are magic and have a sum of 5150. For 10th order a similar construction is possible using the equal partitionings of the sum 1+2+3+4+5+9+10+11+12+13 = 70: : 1+3+9+10+12 = 2+4+5+11+13 = 35 : 1+13 = 2+12 = 3+11 = 4+10 = 5+9 = 14 : 1<sup>2</sup> + 3<sup>2</sup> + 9<sup>2</sup> + 10<sup>2</sup> + 12<sup>2</sup> = 2<sup>2</sup> + 4<sup>2</sup> + 5<sup>2</sup> + 11<sup>2</sup> + 13<sup>2</sup> = 335 (equal partitioning of squares; semi-bimagic property) This leads to squares having a maximum element of 169 and a pandiagonal magic constant of 850, which are also semi-bimagic with each row or column sum of squares equal to 102,850. ==(6''n''±1)×(6''n''±1) pandiagonal magic squares== A <math>(6n \pm 1) \times (6n \pm 1)</math> pandiagonal magic square can be built by the following algorithm. {{Ordered list |Set up the first column of the square with the first <math>6n \pm 1</math> [[natural number]]s. {{aligned table|cols=7|class=wikitable | 1 | | | | | | | 2 | | | | | | | 3 | | | | | | | 4 | | | | | | | 5 | | | | | | | 6 | | | | | | | 7 | | | | | | }} |Copy the first column into the second column but shift it ring-wise by 2 rows. {{aligned table|cols=7|class=wikitable | 1 | 6 | | | | | | 2 | 7 | | | | | | 3 | 1 | | | | | | 4 | 2 | | | | | | 5 | 3 | | | | | | 6 | 4 | | | | | | 7 | 5 | | | | | }} |Continue copying the current column into the next column with ring-wise shift by 2 rows until the square is filled completely. {{aligned table|cols=7|class=wikitable | 1 | 6 | 4 | 2 | 7 | 5 | 3 | 2 | 7 | 5 | 3 | 1 | 6 | 4 | 3 | 1 | 6 | 4 | 2 | 7 | 5 | 4 | 2 | 7 | 5 | 3 | 1 | 6 | 5 | 3 | 1 | 6 | 4 | 2 | 7 | 6 | 4 | 2 | 7 | 5 | 3 | 1 | 7 | 5 | 3 | 1 | 6 | 4 | 2 }} |Build a second square and copy the [[transpose]] of the first square into it. {{aligned table|cols=2|class=wikitable | {{mvar|A}} {{aligned table|cols=7|class=wikitable | 1 | 6 | 4 | 2 | 7 | 5 | 3 | 2 | 7 | 5 | 3 | 1 | 6 | 4 | 3 | 1 | 6 | 4 | 2 | 7 | 5 | 4 | 2 | 7 | 5 | 3 | 1 | 6 | 5 | 3 | 1 | 6 | 4 | 2 | 7 | 6 | 4 | 2 | 7 | 5 | 3 | 1 | 7 | 5 | 3 | 1 | 6 | 4 | 2 }} | <math>A^T</math> {{aligned table|cols=7|class=wikitable | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 6 | 7 | 1 | 2 | 3 | 4 | 5 | 4 | 5 | 6 | 7 | 1 | 2 | 3 | 2 | 3 | 4 | 5 | 6 | 7 | 1 | 7 | 1 | 2 | 3 | 4 | 5 | 6 | 5 | 6 | 7 | 1 | 2 | 3 | 4 | 3 | 4 | 5 | 6 | 7 | 1 | 2 }} }} |Build the final square by multiplying the second square by <math>6n \pm 1</math>, adding the first square and subtract <math>6n \pm 1</math> in each cell of the square. Example: <math>A + (6n \pm 1)A^T - (6n \pm 1)B</math>, where {{mvar|B}} is the magic square with all cells as 1. {{aligned table|cols=7|class=wikitable | 1 | 13 | 18 | 23 | 35 | 40 | 45 | 37 | 49 | 5 | 10 | 15 | 27 | 32 | 24 | 29 | 41 | 46 | 2 | 14 | 19 | 11 | 16 | 28 | 33 | 38 | 43 | 6 | 47 | 3 | 8 | 20 | 25 | 30 | 42 | 34 | 39 | 44 | 7 | 12 | 17 | 22 | 21 | 26 | 31 | 36 | 48 | 4 | 9 }} }} ==4''n''×4''n'' pandiagonal magic squares== A <math>4n \times 4n</math> pandiagonal magic square can be built by the following algorithm. {{ordered list |Put the first <math>2n</math> natural numbers into the first row and the first <math>2n</math> columns of the square. {{aligned table|cols=8|class=wikitable | 1 | 2 | 3 | 4 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | }} |Put the next <math>2n</math> natural numbers beneath the first <math>2n</math> natural numbers in reverse. Each vertical pair must have the same sum. {{aligned table|cols=8|class=wikitable | 1 | 2 | 3 | 4 | | | | | 8 | 7 | 6 | 5 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | }} |Copy that <math>2 \times 2n</math> rectangle <math>2n-1</math> times beneath the first rectangle. {{aligned table|cols=8|class=wikitable | 1 | 2 | 3 | 4 | | | | | 8 | 7 | 6 | 5 | | | | | 1 | 2 | 3 | 4 | | | | | 8 | 7 | 6 | 5 | | | | | 1 | 2 | 3 | 4 | | | | | 8 | 7 | 6 | 5 | | | | | 1 | 2 | 3 | 4 | | | | | 8 | 7 | 6 | 5 | | | | }} |Copy the left <math>4n \times 2n</math> rectangle into the right <math>4n \times 2n</math> rectangle but shift it ring-wise by one row. {{aligned table|cols=8|class=wikitable | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 }} | Build a second <math>4n \times 4n</math> square and copy the first square into it but turn it by 90°. {{aligned table|cols=2|class=wikitable | {{mvar|A}} {{aligned table|cols=8|class=wikitable | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | 8 | 7 | 6 | 5 | 8 | 7 | 6 | 5 | 1 | 2 | 3 | 4 }} | {{mvar|B}} {{aligned table|cols=8|class=wikitable | 5 | 4 | 5 | 4 | 5 | 4 | 5 | 4 | 6 | 3 | 6 | 3 | 6 | 3 | 6 | 3 | 7 | 2 | 7 | 2 | 7 | 2 | 7 | 2 | 8 | 1 | 8 | 1 | 8 | 1 | 8 | 1 | 4 | 5 | 4 | 5 | 4 | 5 | 4 | 5 | 3 | 6 | 3 | 6 | 3 | 6 | 3 | 6 | 2 | 7 | 2 | 7 | 2 | 7 | 2 | 7 | 1 | 8 | 1 | 8 | 1 | 8 | 1 | 8 }} }} | Build the final square by multiplying the second square by <math>4n</math>, adding the first square and subtract <math>4n</math> in each cell of the square. Example: <math>A + 4nB - 4nC</math>, where {{mvar|C}} is the magic square with all cells as 1. {{aligned table|cols=8|class=wikitable | 33 | 26 | 35 | 28 | 40 | 31 | 38 | 29 | 48 | 23 | 46 | 21 | 41 | 18 | 43 | 20 | 49 | 10 | 51 | 12 | 56 | 15 | 54 | 13 | 64 | 7 | 62 | 5 | 57 | 2 | 59 | 4 | 25 | 34 | 27 | 36 | 32 | 39 | 30 | 37 | 24 | 47 | 22 | 45 | 17 | 42 | 19 | 44 | 9 | 50 | 11 | 52 | 16 | 55 | 14 | 53 | 8 | 63 | 6 | 61 | 1 | 58 | 3 | 60 }} }} If we build a <math>4n \times 4n</math> pandiagonal magic square with this algorithm then every <math>2 \times 2</math> square in the <math>4n \times 4n</math> square will have the same sum. Therefore, many symmetric patterns of <math>4n</math> cells have the same sum as any row and any column of the <math>4n \times 4n</math> square. Especially each <math>2n \times 2</math> and each <math>2 \times 2n</math> rectangle will have the same sum as any row and any column of the <math>4n \times 4n</math> square. The <math>4n \times 4n</math> square is also a [[most-perfect magic square]]. == (6''n''+3)×(6''n''+3) pandiagonal magic squares == A <math>(6n+3) \times (6n+3)</math> pandiagonal magic square can be built by the following algorithm. {{ordered list | Create a <math>(2n+1) \times 3</math> rectangle with the first <math>6n+3</math> natural numbers so that each column has the same sum. You can do this by starting with a 3 × 3 magic square and set up the rest cells of the rectangle in [[meander]]-style. You can also use the pattern shown in the following examples. {{aligned table|cols=3|class=wikitable|style=text-align:center | For 9 × 9 square {{aligned table|cols=3|class=wikitable|style=text-align:center | 1 | 2 | 3 | 5 | 6 | 4 | 9 | 7 | 8 }} vertical sum {{=}} 15 | For 15 × 15 square {{aligned table|cols=3|class=wikitable|style=text-align:center | 1 | 2 | 3 | 5 | 6 | 4 | 9 | 7 | 8 | 10 | 11 | 12 | 15 | 14 | 13 }} vertical sum {{=}} 40 | For 21 × 21 square {{aligned table|cols=3|class=wikitable|style=text-align:center | 1 | 2 | 3 | 5 | 6 | 4 | 9 | 7 | 8 | 10 | 11 | 12 | 15 | 14 | 13 | 16 | 17 | 18 | 21 | 20 | 19 }} vertical sum {{=}} 77 }} | Put this rectangle in the left upper corner of the <math>(6n+3) \times (6n+3)</math> square and two copies of the rectangle beneath it so that the first 3 columns of the square are filled completely. {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 2 | 3 | | | | | | | 5 | 6 | 4 | | | | | | | 9 | 7 | 8 | | | | | | | 1 | 2 | 3 | | | | | | | 5 | 6 | 4 | | | | | | | 9 | 7 | 8 | | | | | | | 1 | 2 | 3 | | | | | | | 5 | 6 | 4 | | | | | | | 9 | 7 | 8 | | | | | | }} | Copy the left 3 columns into the next 3 columns, but shift it ring-wise by 1 row. {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 2 | 3 | 9 | 7 | 8 | | | | 5 | 6 | 4 | 1 | 2 | 3 | | | | 9 | 7 | 8 | 5 | 6 | 4 | | | | 1 | 2 | 3 | 9 | 7 | 8 | | | | 5 | 6 | 4 | 1 | 2 | 3 | | | | 9 | 7 | 8 | 5 | 6 | 4 | | | | 1 | 2 | 3 | 9 | 7 | 8 | | | | 5 | 6 | 4 | 1 | 2 | 3 | | | | 9 | 7 | 8 | 5 | 6 | 4 | | | }} | Continue copying the current 3 columns into the next 3 columns, shifted ring-wise by 1 row, until the square is filled completely. {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 }} |Build a second square and copy the transpose of the first square into it. {{aligned table|cols=2|class=wikitable|style=text-align:center;vertical-align:bottom | {{mvar|A}} {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 | 1 | 2 | 3 | 9 | 7 | 8 | 5 | 6 | 4 | 5 | 6 | 4 | 1 | 2 | 3 | 9 | 7 | 8 | 9 | 7 | 8 | 5 | 6 | 4 | 1 | 2 | 3 }} | <math>A^T</math> {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 5 | 9 | 1 | 5 | 9 | 1 | 5 | 9 | 2 | 6 | 7 | 2 | 6 | 7 | 2 | 6 | 7 | 3 | 4 | 8 | 3 | 4 | 8 | 3 | 4 | 8 | 9 | 1 | 5 | 9 | 1 | 5 | 9 | 1 | 5 | 7 | 2 | 6 | 7 | 2 | 6 | 7 | 2 | 6 | 8 | 3 | 4 | 8 | 3 | 4 | 8 | 3 | 4 | 5 | 9 | 1 | 5 | 9 | 1 | 5 | 9 | 1 | 6 | 7 | 2 | 6 | 7 | 2 | 6 | 7 | 2 | 4 | 8 | 3 | 4 | 8 | 3 | 4 | 8 | 3 }} }} | Build the final square by multiplying the second square by <math>6n+3</math>, adding the first square and subtract <math>6n+3</math> in each cell of the square. Example: <math>A + (6n+3)A^T - (6n+3)B</math>, where {{mvar|B}} is the magic square with all cells as 1. {{aligned table|cols=9|class=wikitable|style=text-align:center | 1 | 38 | 75 | 9 | 43 | 80 | 5 | 42 | 76 | 14 | 51 | 58 | 10 | 47 | 57 | 18 | 52 | 62 | 27 | 34 | 71 | 23 | 33 | 67 | 19 | 29 | 66 | 73 | 2 | 39 | 81 | 7 | 44 | 77 | 6 | 40 | 59 | 15 | 49 | 55 | 11 | 48 | 63 | 16 | 53 | 72 | 25 | 35 | 68 | 24 | 31 | 64 | 20 | 30 | 37 | 74 | 3 | 45 | 79 | 8 | 41 | 78 | 4 | 50 | 60 | 13 | 46 | 56 | 12 | 54 | 61 | 17 | 36 | 70 | 26 | 32 | 69 | 22 | 28 | 65 | 21 }} }} ==References== <references /> * W. S. Andrews, ''Magic Squares and Cubes''. New York: Dover, 1960. Originally printed in 1917. See especially Chapter X. * Ollerenshaw, K., Brée, D.: ''Most-perfect pandiagonal magic squares.'' IMA, Southend-on-Sea (1998) ==External links== * [http://mathworld.wolfram.com/PanmagicSquare.html Panmagic Square at MathWorld] * http://www.azspcs.net/Contest/PandiagonalMagicSquares {{Magic polygons}} {{DEFAULTSORT:Panmagic Square}} [[Category:Magic squares]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Magic polygons
(
edit
)
Template:Math
(
edit
)
Template:Mvar
(
edit
)
Template:Ordered list
(
edit
)
Template:Short description
(
edit
)
Template:Times
(
edit
)
Template:Tmath
(
edit
)