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 diagonals, 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 or reflection, but also if a row or column is moved from one side of the square to the opposite side. As such, an pandiagonal magic square can be regarded as having orientations.
It can be shown that non-trivial pandiagonal magic squares of order 3 do not exist. Suppose the square
is pandiagonally magic with magic constant . Adding sums and results in . Subtracting and we get . However, if we move the third column in front and perform the same argument, we obtain . In fact, using the symmetries of 3 × 3 magic squares, all cells must equal . 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 squares discovered by Lee Sallows – a 3 × 3 pandiagonal magic square does exist.
The smallest non-trivial pandiagonal magic squares are 4 × 4 squares. All 4 × 4 pandiagonal magic squares must be translationally symmetric to the form [1]
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 × 2 subsquare sums to the magic constant, 4 × 4 pandiagonal magic squares are most-perfect magic squares. In addition, the two numbers at the opposite corners of any 3 × 3 square add up to half the magic constant. Consequently, all 4 × 4 pandiagonal magic squares that are associative must have duplicate cells.
All 4 × 4 pandiagonal magic squares using numbers 1-16 without duplicates are obtained by letting a equal 1; letting b, c, d, and e equal 1, 2, 4, and 8 in some order; and applying some translation. For example, with b = 1, c = 2, d = 4, and e = 8, we have the magic square
1 | 12 | 7 | 14 |
8 | 13 | 2 | 11 |
10 | 3 | 16 | 5 |
15 | 6 | 9 | 4 |
The number of 4 × 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! ways to assign 1, 2, 4, and 8 to b, c, d, and e).
There are many 5 × 5 pandiagonal magic squares. Unlike 4 × 4 pandiagonal magic squares, these can be associative. The following is a 5 × 5 associative pandiagonal magic square:
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:
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 combinations of the row, column, and diagonal sums. Consider the pandiagonal magic square
with magic constant s. To prove the quincunx sum (corresponding to the 20+2+13+24+6 = 65 example given above), we can add together the following:
From this sum, subtract the following:
The net result is , which divided by 5 gives the quincunx sum. Similar linear combinations can be constructed for the other quincunx patterns , , and .
No pandiagonal magic square exists of order if consecutive integers are used. But certain sequences of nonconsecutive integers do admit order-() 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:
An additional equal partitioning of the sum of squares guarantees the semi-bimagic property noted below:
Note that the consecutive integer sum 1+2+3+4+5+6 = 21, an 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 A and B, respectively given by:
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 |
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 (where C is the magic square with 1 for all cells) gives the nonconsecutive pandiagonal 6 × 6 square:
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:
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.
A pandiagonal magic square can be built by the following algorithm.
1 | ||||||
2 | ||||||
3 | ||||||
4 | ||||||
5 | ||||||
6 | ||||||
7 |
1 | 6 | |||||
2 | 7 | |||||
3 | 1 | |||||
4 | 2 | |||||
5 | 3 | |||||
6 | 4 | |||||
7 | 5 |
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 |
A
|
|
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 |
A pandiagonal magic square can be built by the following algorithm.
1 | 2 | 3 | 4 | ||||
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 | ||||
1 | 2 | 3 | 4 | ||||
8 | 7 | 6 | 5 |
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 |
A
| B
|
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 pandiagonal magic square with this algorithm then every square in the square will have the same sum. Therefore, many symmetric patterns of cells have the same sum as any row and any column of the square. Especially each and each rectangle will have the same sum as any row and any column of the square. The square is also a most-perfect magic square.
A pandiagonal magic square can be built by the following algorithm.
For 9 × 9 square
| For 15 × 15 square
| For 21 × 21 square
|
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 |
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 |
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 |
A
|
|
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 |
In mathematics, especially historical and recreational mathematics, a square array of numbers, usually positive integers, is called a magic square if the sums of the numbers in each row, each column, and both main diagonals are the same. The "order" of the magic square is the number of integers along one side (n), and the constant sum is called the "magic constant". If the array includes just the positive integers , the magic square is said to be "normal". Some authors take "magic square" to mean "normal magic square".
The Ulam spiral or prime spiral is a graphical depiction of the set of prime numbers, devised by mathematician Stanisław Ulam in 1963 and popularized in Martin Gardner's Mathematical Games column in Scientific American a short time later. It is constructed by writing the positive integers in a square spiral and specially marking the prime numbers.
In mathematics, specifically in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix, known as the matrix product, has the number of rows of the first and the number of columns of the second matrix. The product of matrices A and B is denoted as AB.
In combinatorial mathematics, the Catalan numbers are a sequence of natural numbers that occur in various counting problems, often involving recursively defined objects. They are named after the French-Belgian mathematician Eugène Charles Catalan, though they were previously discovered in the 1730s by Minggatu.
In mathematics, a magic cube is the 3-dimensional equivalent of a magic square, that is, a collection of integers arranged in an n × n × n pattern such that the sums of the numbers on each row, on each column, on each pillar and on each of the four main space diagonals are equal, the so-called magic constant of the cube, denoted M3(n). If a magic cube consists of the numbers 1, 2, ..., n3, then it has magic constant (sequence A027441 in the OEIS)
Proofs of the mathematical result that the rational number 22/7 is greater than π (pi) date back to antiquity. One of these proofs, more recently developed but requiring only elementary techniques from calculus, has attracted attention in modern mathematics due to its mathematical elegance and its connections to the theory of Diophantine approximations. Stephen Lucas calls this proof "one of the more beautiful results related to approximating π". Julian Havil ends a discussion of continued fraction approximations of π with the result, describing it as "impossible to resist mentioning" in that context.
The magic constant or magic sum of a magic square is the sum of numbers in any row, column, or diagonal of the magic square. For example, the magic square shown below has a magic constant of 15. For a normal magic square of order n – that is, a magic square which contains the numbers 1, 2, ..., n2 – the magic constant is .
A most-perfect magic square of order n is a magic square containing the numbers 1 to n2 with two additional properties:
An antimagic square of order n is an arrangement of the numbers 1 to n2 in a square, such that the sums of the n rows, the n columns and the two diagonals form a sequence of 2n + 2 consecutive integers. The smallest antimagic squares have order 4. Antimagic squares contrast with magic squares, where each row, column, and diagonal sum must have the same value.
In mathematics, a magic cube of order is an grid of natural numbers satisying the property that the numbers in the same row, the same column, the same pillar or the same length- diagonal add up to the same number. It is a -dimensional generalisation of the magic square. A magic cube can be assigned to one of six magic cube classes, based on the cube characteristics. A benefit of this classification is that it is consistent for all orders and all dimensions of magic hypercubes.
In recreational mathematics, a pandiagonal magic cube is a magic cube with the additional property that all broken diagonals have the same sum as each other. Pandiagonal magic cubes are extensions of diagonal magic cubes and generalize pandiagonal magic squares to three dimensions.
A magic hexagon of order n is an arrangement of numbers in a centered hexagonal pattern with n cells on each edge, in such a way that the numbers in each row, in all three directions, sum to the same magic constant M. A normal magic hexagon contains the consecutive integers from 1 to 3n2 − 3n + 1. Normal magic hexagons exist only for n = 1 and n = 3. Moreover, the solution of order 3 is essentially unique. Meng gives a less intricate constructive proof.
In the mathematical field of combinatorics, given a collection of subsets of a set , an exact cover is a subcollection of such that each element in is contained in exactly one subset in . One says that each element in is covered by exactly one subset in . An exact cover is a kind of cover. It is non-deterministic polynomial time (NP) complete and has a variety of applications, ranging from the optimization of airline flight schedules, cloud computing, and electronic circuit design.
In mathematics, especially in probability and combinatorics, a doubly stochastic matrix (also called bistochastic matrix) is a square matrix of nonnegative real numbers, each of whose rows and columns sums to 1, i.e.,
In recreational mathematics and the theory of magic squares, a broken diagonal is a set of n cells forming two parallel diagonal lines in the square. Alternatively, these two lines can be thought of as wrapping around the boundaries of the square to form a single sequence.
In mathematics, a square matrix is said to be diagonally dominant if, for every row of the matrix, the magnitude of the diagonal entry in a row is greater than or equal to the sum of the magnitudes of all the other (off-diagonal) entries in that row. More precisely, the matrix is diagonally dominant if
In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix. The product sometimes includes a permutation matrix as well. LU decomposition can be viewed as the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations using LU decomposition, and it is also a key step when inverting a matrix or computing the determinant of a matrix. The LU decomposition was introduced by the Polish astronomer Tadeusz Banachiewicz in 1938. To quote: "It appears that Gauss and Doolittle applied the method [of elimination] only to symmetric equations. More recent authors, for example, Aitken, Banachiewicz, Dwyer, and Crout … have emphasized the use of the method, or variations of it, in connection with non-symmetric problems … Banachiewicz … saw the point … that the basic problem is really one of matrix factorization, or “decomposition” as he called it." It is also sometimes referred to as LR decomposition.
In combinatorial mathematics, a rook polynomial is a generating polynomial of the number of ways to place non-attacking rooks on a board that looks like a checkerboard; that is, no two rooks may be in the same row or column. The board is any subset of the squares of a rectangular board with m rows and n columns; we think of it as the squares in which one is allowed to put a rook. The board is the ordinary chessboard if all squares are allowed and m = n = 8 and a chessboard of any size if all squares are allowed and m = n. The coefficient of x k in the rook polynomial RB(x) is the number of ways k rooks, none of which attacks another, can be arranged in the squares of B. The rooks are arranged in such a way that there is no pair of rooks in the same row or column. In this sense, an arrangement is the positioning of rooks on a static, immovable board; the arrangement will not be different if the board is rotated or reflected while keeping the squares stationary. The polynomial also remains the same if rows are interchanged or columns are interchanged.
In mathematics, the Schröder number also called a large Schröder number or big Schröder number, describes the number of lattice paths from the southwest corner of an grid to the northeast corner using only single steps north, northeast, or east, that do not rise above the SW–NE diagonal.
Sriramachakra is a mystic diagram or a yantra given in Tamil almanacs as an instrument of astrology for predicting one's future. The geometrical diagram consists of a square divided into smaller squares by equal numbers of lines parallel to the sides of the square. Certain integers in well defined patterns are written in the various smaller squares. In some almanacs, for example, in the Panchangam published by the Sringeri Sharada Peetham or the Pnachangam published by Srirangam Temple, the diagram takes the form of a magic square of order 4 with certain special properties. This magic square belongs to a certain class of magic squares called strongly magic squares which has been so named and studied by T V Padmakumar, an amateur mathematician from Thiruvananthapuram, Kerala. In some almanacs, for example, in the Pambu Panchangam, the diagram consists of an arrangement of 36 small squares in 6 rows and 6 columns in which the digits 1, 2, ..., 9 are written in that order from left to right starting from the top-left corner, repeating the digits in the same direction once the digit 9 is reached.