Showing posts with label anti-magic. Show all posts
Showing posts with label anti-magic. Show all posts

Thursday, 25 April 2024

Anti-Magic Squares Revisited

I've written about magic squares before. Here are links to these posts:

In this post, I intend to revisit anti-magic squares and the numbers associated with OEIS A117560:


 A117560

\( \text{a}(n) = \dfrac {n \cdot (n^2-1)}{2} - 1 \)



The OEIS comments state that:
\( \text{a}(n-1) \) is an approximation for the lower bound of the "antimagic constant" of an antimagic square of order \(n\). The antimagic constant here is defined as the least integer in the set of consecutive integers to which the rows, columns and diagonals of the square sum. 
The initial members of this sequence are:

2, 11, 29, 59, 104, 167, 251, 359, 494, 659, 857, 1091, 1364, 1679, 2039, 2447, 2906, 3419, 3989, 4619, 5312, 6071, 6899, 7799, 8774, 9827, 10961, 12179, 13484, 14879, 16367, 17951, 19634, 21419, 23309, 25307, 27416, 29639, 31979, 34439, 37022

27416 is highlighted because it is my diurnal age today and when I made my post about anti-magic squares on July 17th 2018, I was 25307 days old. This number immediately precedes 27416, a gap of 2109 (about 5.77 years in terms of days counted). It will be 2223 days, about 6.09 years, before the next number is reached.

The current number, 27416, relates to an approximation of the lowest integer of a 38 x 38 anti-magic square. Note that it is not necessarily the lowest, it's just an approximation. My July 2018 entry is quite thorough and there's no point repeating all the content there but Figure 1 shows an example of 4 x 4 anti-magic square just to reinforce the property of such a square.

Figure 1: source

The ten sums from a sequence of consecutive numbers, namely 
30, 31, 32, 33, 34, 35, 36, 37, 38, 39. Figure 2 shows a different arrangement. Note that OEIS A117560 gives 29 as the lower bound here.

Figure 2: source

Note that an anti-magic square differs from a so-called heterosquare. As explained in Wolfram Mathworld
A heterosquare is an \(n \times n\) array of the integers from \(1\) to \(n^2\) such that the rows, columns, and diagonals have different sums. By contrast, in a magic square, they have the same sum. There are no heterosquares of order two, but heterosquares of every odd order exist. They can be constructed by placing consecutive integers in a spiral pattern (Fults 1974, Madachy 1979). An antimagic square is a special case of a heterosquare for which the sums of rows, columns, and main diagonals form a sequence of consecutive integers.

Figure 3 shows an example of a 4 x 4 heterosquare:

Figure 3: source

These numbers do not form a sequence of consecutive integers and so they do not form an anti-magic square.

Tuesday, 17 July 2018

Anti-Magic Squares

Today I turned 25307 days old and, as is my habit, I examined the entries for this number in the Online Encyclopaedia of Integer Sequences or OEIS. I've already mentioned 25307 in my previous post as forming part of a prime quadruple consisting of 25301, 25303, 25307 and 25309. For this reason, it is mentioned in OEIS A136721 Prime quadruples: 3rd term.

However, I also came across a mention of the number in OEIS A117560 \(n(n^2-1)/2 - 1\) which at first sight seemed unremarkable. However, on reading further I discovered that the numbers in this sequence form an:
approximation for the lower bound of the "anti-magic constant" of an anti-magic square of order n. The anti-magic constant here is defined as the least integer in the set of consecutive integers to which the rows, columns and diagonals of the square sum
I was of course familiar with magic squares but I'd never heard of anti-magic squares. I was prompted to investigate further.

To quote from WolframAlpha:
An anti-magic square is an \(n×n\) array of integers from \(1\) to \(n^2\) such that each row, column, and main diagonal produces a different sum such that these sums form a sequence of consecutive integers. It is therefore a special case of a heterosquare. It was defined by Lindon (1962) and appeared in Madachy's collection of puzzles (Madachy 1979, p. 103), originally published in 1966.
There are no \(2 \times 2\) or \(3 \times 3\) anti-magic squares. The first occurrence is of a \(4 \times 4 \) anti-magic square and shown below are examples of anti-magic squares from \(4 \times 4\) to \(9 \times 9\):


The formula \(0.5 \times n(n^2-1)-1 \) yields 251 in the case of \(n=8 \) but it should be remembered that this number is a lower bound. There are \( 8 \times 8\) anti-magic squares that start with a higher number. Below is a diagram of an \( 8 \times 8\) anti-magic square showing the various totals from 252 to 269 (as opposed to 251 to 268 in the example above):


In the case of 25307, the value of \(n\) is 37. So the sum of any sequences formed by adding the elements in any row, column or diagonal of this \(37 \times 37\) anti-magic square of numbers have 25307 as their lower bound.

There is a similar sequence for the upper bounds of anti-magic squares. The formula for generating the terms is:$$ \lfloor \frac{n(n^3-n-3)}{2(n-1)} \rfloor $$The OEIS is A117561.