Showing posts with label associative. Show all posts
Showing posts with label associative. Show all posts

Friday, 12 November 2021

Ultramagic Squares

Here is a definition of an ultramagic square:

A magic square is associative if the sum of any two elements symmetric about its center is the same. A magic square is pandiagonal if the sum of the numbers in any broken diagonal equals the magic constant. A magic square is ultramagic if it is associative and pandiagonal. Ultramagic squares exist for orders n>=5. Source.

Using this as a starting point, let's understand what is meant by a pandiagonal magic square. Here is a definition taken from a most useful website:

Pandiagonal magic squares are magic squares, where also the broken diagonals sum to the magic constant. This means when you go off of one edge on a diagonal, continue (wrap-around) to the corresponding cell on the opposite edge. These squares are considered as one of the top classes of magic squares.

Figures 1 and 2 show clearly what is meant by a "broken diagonal" and show a 5 x 5 magic square that is pandiagonal. 


Figure 1


Figure 2

The magic square in Figures 1 and 2 however, is not associative. Using the central square (24) as a reference point, we note that, up-down 3 + 12 = 15 but left-right 20 + 6 = 26. These must be equal for a magic square to be associative. Figure 3 shows a 5 x 5 magic square that is both pandiagonal and associative, and thus ultramagic.

Figure 3

The magic constant for this square is 65 and it can be seen that all rows, columns, main diagonals and broken diagonals all add to this number. Furthermore, the up-down 6 + 20 = 26 and the left-right 2 + 24 = 26 are this time equal as are all the other symmetric pairs of elements.

Figure 3 shows a 7 x 7 ultramagic square:


Figure 4: source

Figures 5, 6 and 7 show 6 x 6, 7 x 7 and 8 x 8 prime ultramagic squares with magic constants of 990, 4613 and 2040 respectively:
Figure 5: source


Figure 6: source


Figure 8: source

These magic constants (990, 4613 and 2040) are the lowest possible and form part of OEIS A257316:


 A257316

Smallest magic constant of ultramagic squares of order \(n\) composed of distinct prime numbers.


The sequence runs 3505, 990, 4613, 2040 with 3505 being the magic constant (not shown) for the 5 x 5 ultramagic square with minimal magic constant. The following bounds for the next terms are known:
  • 12249 <=a(9) <=13059
  • 4200 <=a(10) <=46150
  • a(11) >= 26521
  • a(12) >= 8820
  • a(13) >= 49439
  • a(14) >= 16170
  • a(15) >= 74595
  • a(16) >= 21840
My attention was attracted to the topic because today I turned 26521 days old and this number happens to be the lower bound for the 11 x 11 prime ultramagic square with minimal magic constant. The exact composition of such a square is presumably still not known.

My earlier posts on Magic Squares are:

Wednesday, 10 April 2019

Fields and Modular Arithmetic

I only recently became aware of the fact that a set of elements like {0, 1, 2, 3, 4, 5, 6} forms a field under modular arithmetic with modulus 7 (the number of elements in the set). The condition is that there are a prime number of elements in the set. Let's firstly define this idea of modular arithmetic:

Figure 1: extract from
https://crypto.stanford.edu/pbc/notes/numbertheory/arith.html

Now what is a field? Here's a definition from http://www.applet-magic.com/field.htm:
A field \(F\) consists of a set \(S\) of elements and two binary functions \(f \) and \(g\) defined on \(S\) and whose values are in \(S.\) Both binary functions are associative, \(f(a, f(b,c)\) is equal to \(f( f(a, b), c)\) for all \(a\), \(b\) and \(c\) in \(S\) and likewise for \(g\). The binary function \(f\), called addition is necessarily commutative; i.e., \(f(a, b)\) is equal to \(f(b,a)\) for all \(a\) and \(b\) in \(S\). The other function \(g\), called multiplication, is not necessarily commutative. There is an identity for each functions; i.e. there exist \(e\) such that \(f(e, a)=a\) for all \(a\) in \(S\) and an \(l\) such that \(g(l, a)=a\) for all \(a\) in \(S\). There exist additive inverses for all elements of \(S\) and multiplicative inverses for all elements of \(S\) except the additive identity. This means that for any element \(a\) in \(S \) there exist \(a\) and \(b\) such that \(f(a, b)=e\). Such \(a\) \(b\) is denoted as \(−a\). For any element \(a\) in \(S \) that is not \(e \) there exists \(a\) and \(b \) such that \(g(a, b)\) is equal to \(l.\) The element \(b\) is usually denoted as \(a^{−1} \). Furthermore there is distributivity of multiplication with respect to addition; i.e. \( g(a, f(b, c)) \) is equal to \( f((g(a,b), g(a, c))  \) for all \(a,\), \(b \) and \(c\) in \(S\).
The set of \(n\) x \(n\) matrices is an example of a field in which multiplication is not commutative. Putting the whole business less formally, we can say that a set of elements form a field if the set is closed under the operations of addition, subtraction, multiplication and division. In other words, these operations when applied to two elements in the set always produce a third element that is also in the set. An example is {0, 1, 2, 3, 4, 5, 6} and it is easy to set up tables for all four operations verifying the set is indeed closed, as it is under all sets with a prime number of elements. Figure 2 shows what happens to the elements of the set under the operation of multiplication by 2:

Figure 2: mapping of elements of mod 7 under multiplication by 2

Figure 3 shows the full multiplication table:

Figure 3: multiplication table for mod 7

Of course, as stated above there is no multiplicative inverse for the additive identity element. In the case of the mod 7, this element is 0 and it means we can't divide by this element just as in regular arithmetic. Figure 4 shows the full division table:

Figure 4: division table for mod 7 with case of 5 divided by 3 highlighted

Figure 5 explains the condition for division to be possible in a modular system:

Figure 4: extract from
https://crypto.stanford.edu/pbc/notes/numbertheory/arith.html