CEMC Banner

Problem of the Week
Problem E and Solution
Favourite Numbers

Problem

Adrian likes all the numbers, but some are his favourites. He created a flowchart to help people determine whether or not a given five-digit positive integer is one of his favourites.

An alternative format for the flowchart
follows.

How many favourite five-digit positive integers does Adrian have?

Solution

We write one of Adrian’s favourite five-digit positive integers as \(V W X Y Z\), where each letter represents a digit.

Since this integer does not contain any even or repeated digits, then it is created using the digits \(1\), \(3\), \(5\), \(7\), and \(9\), in some order. We want to count the number of ways of assigning \(1\), \(3\), \(5\), \(7\), \(9\) to the digits \(V\), \(W\), \(X\), \(Y\), \(Z\) so that the answers to the second two questions in the flowchart are both yes.

Since the thousands digit is larger than both the hundreds digit and the ten thousands digit, then \(W > X\) and \(W > V\). Since the tens digit is larger than both the hundreds digit and the units digit, then \(Y > X\) and \(Y > Z\).

The digits \(1\) and \(3\) cannot be placed as \(W\) or \(Y\), since \(W\) and \(Y\) are larger than both of their neighbouring digits, while \(1\) is smaller than all of the other digits and \(3\) is larger than only one of the other possible digits.

The digit \(9\) cannot be placed as \(V\), \(X\), or \(Z\) since it is the largest possible digit and so cannot be smaller than \(W\) or \(Y\) . Thus, \(9\) must be placed as \(W\) or as \(Y\). Therefore, the digits \(W\) and \(Y\) are \(9\) and either \(5\) or \(7\).

Suppose that \(W = 9\) and \(Y = 5\). The number is thus \(V 9 X 5 Z\). Neither \(X\) or \(Z\) can equal \(7\) since \(7 > 5\), so \(V = 7\). It follows that \(X\) and \(Z\) are \(1\) and \(3\), or \(3\) and \(1\). There are \(2\) possible integers in this case. Similarly, if \(Y = 9\) and \(W = 5\), there are \(2\) possible integers.

Suppose that \(W = 9\) and \(Y = 7\). The number is thus \(V 9 X 7 Z\). The digits \(1\), \(3\), and \(5\) can then be placed in any of the remaining spots. There are \(3\) choices for the digit \(V\). For each of these choices, there are \(2\) choices for \(X\), and then \(1\) choice for \(Z\). There are thus \(3 \times 2 \times 1 = 6\) possible integers in this case. Similarly, if \(Y = 9\) and \(W = 7\), there are \(6\) possible integers.

Therefore, Adrian has \(2 + 2 + 6 + 6 = 16\) favourite positive five-digit integers.