# A cool number-theoretic puzzle in IMAT: find the last digit

This test is from IMAT 2015 (International Medical Admission Test):

When I made a hotel reservation online yesterday I was given an $8$ digit booking reference which contained no zeros. It did, however, consist of three $2$ digit odd numbers followed by the sum of these three numbers, and all eight digits were different. The first digit of the booking reference was $4$. What was the last digit?

You don't actually need to solve the puzzle to find that the answer must be $7$. If the problem is legit, by noticing that the following $8$ digit booking reference satisfies all the conditions, we immediately conclude that either the answer is 7 or the problem is ill-proposed:

$$\text{4 5 2 3 1 9 8 7}$$

But does the problem have a well-defined answer? If yes, what's an easy proof for it?

I think I have a long proof that separates cases:

1. Since the sum of three odd numbers is odd, the last digit must be odd.

2. Since $4$+$2$ is $6$ and the sum must stay a two-digit number, one of the three numbers must be of the form $\text{1_}$ or $\text{3_}$. But $\text{3_}$ is not acceptable, because if so, the sum would still get larger than $100$.

So, we so far have a booking reference of this form: $$\text{4 x 1 y _ z _ t}$$

Now let's consider $(x,y,z,t)$.

1. $3$ and $7$ cannot show up together in the first three components because they sump up to $10$ and this will violate all eight digits being different.

There are only two choices left: $(3,5,9)$ and $(5,7,9)$

1. $(5,7,9)$ is not acceptable because $5+7+9 \equiv 1 \pmod{10}$.

Therefore the only possible choice for the last digit is $7$.

Q.E.D.

Can someone think of a shorter proof?

There are five odd digits in total and four of them must occur in the four unit places. Also, some odd digit must occur among the tens places of the three summands as $2+4+6$ would be too big. Then the tens of the sum must be even, at most $8$. So the odd tens digit is at most $8-4-2$, hence $1$ is in some tens place and our four odd unit digits are $3,5,7,9$. If $d$ is the last digit, then $2d\equiv 3+5+7+9\equiv 4\pmod {10}$ and hence $d=7$.
• This is a great answer. However, for the sake of completeness, you also need to add that there must be an odd digit less than $4$ in a tens place to complete your argument. In fact, we still need step 1 and 2 in my argument, but we can simplify step 3 and 4 by using your argument. Jun 15, 2016 at 11:04