# 1998 AIME Problems/Problem 15

## Problem

Define a domino to be an ordered pair of distinct positive integers. A proper sequence of dominos is a list of distinct dominos in which the first coordinate of each pair after the first equals the second coordinate of the immediately preceding pair, and in which $(i,j)$ and $(j,i)$ do not both appear for any $i$ and $j$. Let $D_{40}$ be the set of all dominos whose coordinates are no larger than 40. Find the length of the longest proper sequence of dominos that can be formed using the dominos of $D_{40}.$

## Solution 1

We can draw a comparison between the domino a set of 40 points (labeled 1 through 40) in which every point is connected with every other point. The connections represent the dominoes.

You need to have all even number of segments coming from each point except 0 or 2 which have an odd number of segments coming from the point. (Reasoning for this: Everytime you go to a vertex, you have to leave the vertex, so every vertex reached is equivalent to adding 2 more segments. So the degree of each vertex must be even, with the exception of endpoints) Since there are 39 segments coming from each point it is impossible to touch every segment.

But you can get up to 38 on each segment because you go in to the point then out on a different segment. Counting going out from the starting and ending at the ending point we have: $\frac{38\cdot 38 + 2\cdot 39}2 = \boxed{761}$

Clarification : To clarify the above solution, every time you move to a new vertex, you take one path in and must leave by another path. Therefore every vertex needs to have an even number of segments leaving it (with the exception of the first and last), because the "in" and "out" segments must make a pair.

## Solution 2

A proper sequence can be represented by writing the common coordinates of adjacent ordered pairs once. For example, represent (4,7),(7,3),(3,5) as $4,7,3,5 .$ Label the vertices of a regular $n$ -gon $1,2,3, \ldots, n .$ Each domino is thereby represented by a directed segment from one vertex of the $n$ -gon to another, and a proper sequence is represented as a path that retraces no segment. Each time that such a path reaches a non-terminal vertex, it must leave it.

Thus, when $n$ is even, it is not possible for such a path to trace every segment, for an odd number of segments emanate from each vertex. By removing $\frac{1}{2}(n-2)$ suitable segments, however, it can be arranged that $n-2$ segments will emanate from $n-2$ of the vertices and that an odd number of segments will emanate from exactly two of the vertices.

In this situation, a path can be found that traces every remaining segment exactly once, starting at one of the two exceptional vertices and finishing at the other. This path will have length $\left(\begin{array}{l}n \\ 2\end{array}\right)-\frac{1}{2}(n-2),$ which is 761 when $n=40$.

~phoenixfire

### Note 1

When $n$ is odd, a proper sequence of length $\left(\begin{array}{c}n \\ 2\end{array}\right)$ can be found using the dominos of $D_{n}$. In this case, the second coordinate of the final domino equals the first coordinate of the first domino.

~phoenixfire

## Solution 3

Let $A_{n}=\{1,2,3, \ldots, n\}$ and $D_{n}$ be the set of dominos that can be formed using integers in $A_{n} .$ Each $k$ in $A_{n}$ appears in $2(n-1)$ dominos in $D_{n},$ hence appears at most $n-1$ times in a proper sequence from $D_{n}.$ Except possibly for the integers $i$ and $j$ that begin and end a proper sequence, every integer appears an even number of times in the sequence.

Thus, if $n$ is even, each integer different from $i$ and $j$ appears on at most $n-2$ dominos in the sequence, because $n-2$ is even, and $i$ and $j$ themselves appear on at most $n-1$ dominos each. This gives an upper bound of $$\frac{1}{2}\left[(n-2)^{2}+2(n-1)\right]=\frac{n^{2}-2 n+2}{2}$$ dominos in the longest proper sequence in $D_{n}.$ This bound is in fact attained for every even $n.$ It is easy to verify this for $n=2$, so assume inductively that a sequence of this length has been found for a particular value of $n$.

Without loss of generality, assume $i=1$ and $j=2,$ and let $_{p} X_{p+2}$ denote a four-domino sequence of the form $(p, n+1)(n+1, p+1)(p+1, n+2)(n+2, p+2) .$ By appending $${ }_{2} X_{4},{ }_{4} X_{6}, \ldots,{ }_{n-2} X_{n},(n, n+1)(n+1,1)(1, n+2)(n+2,2)$$ to the given proper sequence, a proper sequence of length $$\frac{n^{2}-2 n+2}{2}+4 \cdot \frac{n-2}{2}+4=\frac{n^{2}+2 n+2}{2}=\frac{(n+2)^{2}-2(n+2)+2}{2}$$ is obtained that starts at $i=1$ and ends at $j=2 .$ This completes the inductive proof.

In particular, the longest proper sequence when $n=40$ is 761.

~phoenixfire

### Note 2

In the language of graph theory, this is an example of an Eulerian circuit.

~phoenixfire

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 