Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to johnstevens77,Bhoddhisatva,scotia,Anonymous,Cornytiv34, for Donating to support the site

Hexagon

cinelli
Lemon Slice
Posts: 550
Joined: November 9th, 2016, 11:33 am
Has thanked: 231 times
Been thanked: 160 times

Hexagon

#89277

Postby cinelli » October 19th, 2017, 11:46 am

4  9  2

3 5 7

8 1 6

Shown above is a magic square. The numbers 1 to 9 have been arranged so that the numbers in all rows, columns and main diagonals add up to the same total.

This puzzle is to find the arrangement of a magic hexagon so that the numbers 1 to 19 are arranged so all 15 rows, ABC, DEFG, HIJKL, MNOP, QRS, ADH, BEIM, CFJNQ, GKOR, LPS, HMQ, DINR. AEJOS, BFKP AND CGL have the same sum.

.   A   B   C

D E F G

H I J K L

M N O P

Q R S

Cinelli

UncleEbenezer
The full Lemon
Posts: 10690
Joined: November 4th, 2016, 8:17 pm
Has thanked: 1459 times
Been thanked: 2965 times

Re: Hexagon

#89338

Postby UncleEbenezer » October 19th, 2017, 4:38 pm


We don't know a priori that there's a solution. Neither do we know how many solutions, except that it's a multiple of 12 (each underlying solution has six rotations and their mirror images). Furthermore, the sum is less obvious than with the square, as the rows are not of equal length. Best we have is that the length-3 rows contain the higher numbers.

Best solution I can see is to throw the 'puter at it. The only smart bit is avoiding a dumb hugely-nested loop, by eliminating useless and duplicated cases at the earliest opportunity. Turns out there is exactly one solution set. Using the constraint that A is the lowest-number vertex and C<H, we have:

Some text needed here or this silly editor will collapse the space left of A
3 19 16
17 7 2 12
18 1 5 4 10
11 6 8 13
9 14 15


Gengulphus
Lemon Quarter
Posts: 4255
Joined: November 4th, 2016, 1:17 am
Been thanked: 2628 times

Re: Hexagon

#89593

Postby Gengulphus » October 20th, 2017, 4:14 pm

A puzzle I thought of posting quite a while back, but I think the idea got lost in the chaos of setting up the TLF boards after the TMF boards were closed. And a somewhat unsatisfactory puzzle, because although there is just one solution (up to rotations and reflections), I don't believe any simple argument is known that demonstrates that other than "I programmed a computer to solve this, basically by brute force, and it only found one solution". (I have seen some humanly-comprehensible arguments, but they're long enough and with enough cases that I'm doubtful that they would fit into a single post - TLF has a 50k character limit on posts...)

A rather easier puzzle: what other sizes of "magic hexagon" exist? It's easy to see that the degenerately simple case of a side 1 "magic hexagon" does exist, consisting of just the single number "1" that sums to 1 in all directions. And it's also easy to see that a side 2 "magic hexagon" doesn't exist - the fact that all of the length 2 edges sum to the same total T means that the corners must alternate in an n, T-n, n, T-n, n, T-n pattern around the hexagon, but that isn't compatible with all the numbers in the hexagon being different. And this puzzle's solution says that a side 3 "magic hexagon" does exist. What about larger "magic hexagons"?

Gengulphus

cinelli
Lemon Slice
Posts: 550
Joined: November 9th, 2016, 11:33 am
Has thanked: 231 times
Been thanked: 160 times

Re: Hexagon

#90090

Postby cinelli » October 23rd, 2017, 12:46 pm

There is an interesting story behind this problem, related by Martin Gardner, the great populariser of mathematics. A solution was found by one Clifford Addams in 1957 by trial and error, after 40 years’ work. He lost the solution and found it again in 1962. You have to admire his perseverance. It’s one thing to find an answer here where the presumption is that a solution exists. It is a different matter spending years looking for a solution which is unlikely to exist. And I think it is unlikely that all fifteen sums would be equal.

And yes. The solution for the size 3 hexagon is unique, up to rotations and reflections. Well done UncleEbenezer.

Cinelli

cinelli
Lemon Slice
Posts: 550
Joined: November 9th, 2016, 11:33 am
Has thanked: 231 times
Been thanked: 160 times

Re: Hexagon

#93038

Postby cinelli » November 4th, 2017, 12:41 pm

Gengulphus asked if any other magic hexagons exist, apart from size three and the trivial size one one. The answer turns out to be no. It is enough to consider what would be the constant sum, if such a hexagon did exist. For the general case of side n >= 1, we would have to fit in all numbers between

1 and 2(n+ ... +2n-2)+2n-1

i.e. between 1 and 3n^2-3n+1

The sum of all these numbers is

(1/2)(3n^2-3n+1)(3n^2-3n+2) = 9n^4-18n^3+18n^2-9n+2

and this sum has to be spread equally among 2n-1 rows. In other words

(1/2)(3n^2-3n+1)(3n^2-3n+2)/(2n-1)

must be a whole number, call it c. If you do the long division and calculate the remainder,

c = (9/4)n^3-(27/8)n^2+(45/16)n-(27/32) + 5/(32(2n-1))

Multiplying through by 32 we get

32c = 9(8n^3-12n^2+10n-3) + 5/(2n-1)

For this equation to be valid it must be that 5/(2n-1) is an integer. The only cases which meet this condition are n = 1 and 3. Plugging in n=3 gives c=38 which is the constant in UncleEbenezer’s solution.

Cinelli

UncleEbenezer
The full Lemon
Posts: 10690
Joined: November 4th, 2016, 8:17 pm
Has thanked: 1459 times
Been thanked: 2965 times

Re: Hexagon

#93077

Postby UncleEbenezer » November 4th, 2017, 2:46 pm

cinelli wrote:Gengulphus asked if any other magic hexagons exist, apart from size three and the trivial size one one. The answer turns out to be no.

Indeed.

Sadly I already knew that, not through working it out, but through having googled after posting my original reply but before Gengulphus posed the supplementary question. So there seemed no point in my saying anything more.

Good that you rise to the challenge when it's thrown back at you!

Gengulphus
Lemon Quarter
Posts: 4255
Joined: November 4th, 2016, 1:17 am
Been thanked: 2628 times

Re: Hexagon

#93157

Postby Gengulphus » November 4th, 2017, 8:54 pm

cinelli wrote:Multiplying through by 32 we get

32c = 9(8n^3-12n^2+10n-3) + 5/(2n-1)

For this equation to be valid it must be that 5/(2n-1) is an integer. The only cases which meet this condition are n = 1 and 3. Plugging in n=3 gives c=38 which is the constant in UncleEbenezer’s solution.

Well done.

Ever since I first encountered this puzzle, it's always struck me as somewhat odd that the n = 3 case is so much harder to resolve than any other, at least without computer aid...

If you'd like another follow-up puzzle: a special case of what you've proved is that a side-4 magic hexagon filled with the numbers 1 to 37 isn't possible. What if we relax the requirements a bit and only ask for a side-4 magic hexagon filled with the numbers N to N+36, for some integer N?

And of course, there are similar questions for all the other side lengths...

Gengulphus


Return to “Games, Puzzles and Riddles”

Who is online

Users browsing this forum: No registered users and 8 guests