How many unit hexagonal tiles can be placed inside a larger hexagon of sides $a,b,c,a,b,c$?

5.4k Views Asked by At

How many unit hexagonal tiles can be placed inside a larger hexagon of sides $a,b,c,a,b,c$? I originally came across this puzzle on the codeforces website.

My first question: what is the mathematics behind solving these kind of puzzles? Just plain algebra?

My second question, more philosophical: how many of you solved this instantly? I could not solve it even after a bit of googling. I am interested in developing my intuition or mathematical aptitude for solving these kind if problems. Any advice? Its been many years since I am out of college.

Some test cases for you to check your answers before you post them. Input 2 3 4 Answer 18

Input 2 2 2 Answer 7

Input 7 8 13 Answer 224

Input 985 2 2 Answer 2956

3

There are 3 best solutions below

2
On BEST ANSWER

View the border hexagon as a projection of box, so that the hexagonal tiles appear to represent somewhat-lumpy spheres stacked in layers.

Hex Box

How does the number of visible spheres (that is, the number of tiles) compare to the area of the three visible faces of the box?

(Image adapted from the figure given on the Codeforces web site.)


To answer your personal questions: I solved this instantly, once I adopted the proper (ahem) perspective; at that point, "the mathematics behind solving" this particular problem became almost-trivial. My advice about such problems in general is to seek out similar insights; reading contest books ---and anything by Martin Gardner--- can help in building your intuition.

By the way, I can't take too much credit for the box insight. Years ago, I came across a fairly classic puzzle about how many unit double-equilateral-triangle rhombi fit into one of these elongated hexagons; the answer becomes clear upon coloring the rhombi based upon which direction (out of three) the long diagonal points: the coloring immediately creates an illusion of stacked cubes, with each color corresponding to the direction in which each cube face ... um ... faces (up, forward, sideways). Ever since then, I've tended to see projected cubes whenever I look at hexagons ... which underscores my point that exposure to mathematical puzzles builds intuition.

0
On

Hint: if we let $a$ be the minimum dimension, think of filling out the corners where $a$ is to make a parallelogram. How many hexagons do you need to use to fill the two corners? What are the resulting dimensions of the parallelogram?

1
On

Edit: My first answer (appended in brackets) is much too complicated. Here is the final version:

The given hexagonal array $H$ of beads can be viewed (in two ways) as the union of three parallelogram shaped arrays containing $ab$, $bc$, and $ca$ beads respectively, any two of them sharing an edge of length $a$, $b$, or $c$, and all three of them having one bead in the interior of $H$ in common. By the inclusion-exclusion principle the total number $N$ of beads is therefore given by $$N=(ab + bc + ca) -(a+b+c)+1\ .$$

[Assume $a\leq b\leq c$, where $a$ is the number of tiles on the vertical edge. Partition the figure by two auxiliary vertical lines into two trapezoidal parts and a central parallelogram shaped part. The $b$ vertical rows in the trapezoidal parts contain resp. $a$, $a+1$, $\ldots$, $a+b-1$ hexagons, and the $c-b-1$ "inner" vertical rows of the parallelogram shaped part contain $a+b-1$ hexagons each. (When $c=b$ then $c-b-1=-1$ which takes care of the fact that in this case the longest vertical column, of length $a+b-1$, has been counted twice so far.) Therefore the total number $N(a,b,c)$ of tiles is given by $$\eqalign{N(a,b,c)&=\bigl(a+(a+1)+\ldots+(a+b-1)\bigr)+(c-b-1)(a+b-1)\cr &= b\bigl(a+(a+b-1)\bigr)+(c-b-1)(a+b-1)\cr &=(ab+bc+ca)-(a+b+c)+1\ .\cr}$$ Since the resulting total is a symmetric function of $a$, $b$, $c$ the assumption $a\leq b\leq c$ used in the proof turns out to be unnecessary.]