Problem D

Five Digits

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.

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\).