CEMC Banner

Problem of the Week
Problem D and Solution
Five Digits

Problem

A sequence starts out with one \(5\), followed by two \(6\)s, then three \(7\)s, four \(8\)s, five \(9\)s, six \(5\)s, seven \(6\)s, eight \(7\)s, nine \(8\)s, ten \(9\)s, eleven \(5\)s, twelve \(6\)s, and so on. (You should notice that only the five digits from \(5\) to \(9\) are used.)

The first \(29\) terms of the sequence appear below.

\(5\), \(6\), \(6\), \(7\), \(7\), \(7\), \(8\), \(8\), \(8\), \(8\), \(9\), \(9\), \(9\), \(9\), \(9\), \(5\), \(5\), \(5\), \(5\), \(5\), \(5\), \(6\), \(6\), \(6\), \(6\), \(6\), \(6\), \(6\), \(7\), \(…\)

Determine the \(2022^{\text{nd}}\) digit in the sequence.

image

Note:
In solving the above problem, it may be helpful to use the fact that the sum of the first \(n\) positive integers is equal to \(\dfrac{n(n+1)}{2}\). That is,

\[1 + 2 + 3 + … + n = \frac{n(n+1)}{2}\] For example, \(1 + 2 + 3 + 4 + 5 = 15\), and \(\dfrac{5(6)}{2} = 15\).

Also, \(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36\), and \(\dfrac{8(9)}{2} = 36\).

Solution

The first group in the sequence contains one \(5\). The second group in the sequence contains two \(6\)s. To the end of the second group of digits, there is a total of \(1+2=3\) digits. The third group in the sequence contains three \(7\)s. To the end of the third group of digits, there is a total of \(1+2+3=6\) digits. The \(n\)th group in the sequence contains \(n\) digits. To the end of the \(n\)th group of digits, there is a total of \(1+2+3+\cdots+n=\dfrac{n(n+1)}{2}\) digits.

How many groups of digits are required for there to be at least \(2022\) digits in the sequence?

We need to find the value of \(n\) so that \(1+2+3+\cdots +n \ge 2022\) and \(1+2+3+\cdots +(n-1) < 2022\). At this point we will use trial and error. At the end of the solution, a more algebraic approach to finding the value of \(n\) using the quadratic formula is presented.

Suppose \(n=100\). Then \(1+2+3+\cdots +100 =\dfrac{100(101)}{2}= 5050>2022\).

Suppose \(n=50\). Then \(1+2+3+\cdots +50 =\dfrac{50(51)}{2}= 1275<2022\).

Suppose \(n=60\). Then \(1+2+3+\cdots +60 =\dfrac{60(61)}{2}= 1830<2022\).

Suppose \(n=65\). Then \(1+2+3+\cdots +65 =\dfrac{65(66)}{2}= 2145>2022\).

Suppose \(n=63\). Then \(1+2+3+\cdots +63 =\dfrac{63(64)}{2}= 2016<2022\).

The \(2022\)nd digit is the sixth number in the next group of digits. That is, the \(2022\)nd digit is a digit in the \(64\)th group of digits.

Now, let’s determine what digit is in the \(64\)th group of digits. Since we cycle through the digits and there are only five digits used, we can determine the digit by examining \(\frac{64}{5} = 12\frac{4}{5}\). Thus, in the \(64\)th group of digits, the digit used is the \(4\)th digit in the sequence of digits. That is, in the \(64\)th group of digits, the digit used is an \(8\).

Since the \(2022\)nd digit is in the \(64\)th group of digits, it follows that the \(2022\)nd digit is an \(8\).

We will finish by showing how we can find the value of \(n\) algebraically.

We will first find the value of \(n, n>0\), so that \[\begin{aligned} \frac{n(n+1)}{2}&=2022\\ n(n+1)&= 4044\\ n^2+n-4044&=0\end{aligned}\] The quadratic formula can be used to solve for \(n\). \[\begin{aligned} n&=\frac{-1\pm\sqrt{1^2-4(1)(-4044)}}{2}\\ &=\frac{-1\pm\sqrt{16\,177}}{2}\end{aligned}\] Since \(n=\dfrac{-1-\sqrt{16\,177}}{2}<0\), it is inadmissible.

Then \(n=\dfrac{-1+\sqrt{16\,177}}{2}\approx 63.09\). But \(n\) is an integer. So, interpreting our result, when \(n=63\), the sum \(1+2+3+\cdots+63<2022\), and when \(n=64\), the sum \(1+2+3+\cdots+64>2022\). Thus, the \(2022\)nd digit is in the \(64\)th group of digits.