Using only the digits 1, 2, 3, 4, and 5, Peri constructed the sequence

$$
1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,1,1,1,1,1,1,2,2,2,2,2,2,2, \ldots
$$

starting with one 1, followed by two 2s, three 3s, four 4s, five 5s, six 1s, seven 2s, and so on. What is the hundredth term of this sequence?
We group the sequence into consecutively numbered blocks, each block formed by consecutive equal terms, as shown below.

$$
\begin{aligned}
& \underbrace{1}_{\text {block } 1}, \underbrace{2,2}_{\text {block } 2}, \underbrace{3,3,3}_{\text {block } 3}, \underbrace{4,4,4,4}_{\text {block } 4}, \underbrace{5,5,5,5,5}_{\text {block } 5}, \underbrace{1,1,1,1,1,1}_{\text {block } 6}, \underbrace{2,2,2,2,2,2,2}_{\text {block } 7} \\
& \underbrace{3,3,3,3,3,3,3,3}_{\text {block } 8}, \underbrace{4,4,4,4,4,4,4,4,4}_{\text {block } 9}, \underbrace{5,5,5,5,5,5,5,5,5,5}_{\text {block } 10} \\
& \underbrace{1,1,1,1,1,1,1,1,1,1}_{\text {block } 11}, \ldots, \underbrace{k, k, k, k, k, k, k, k, k, k, k, k, k, \ldots, k}_{\text {block } n, \operatorname{with} k \in\{1,2,3,4,5\}}, \cdots
\end{aligned}
$$

Notice that the numbering of each block coincides with the number of terms it contains: block 1 has one term, block 2 has two terms, block 3 has three terms, and so on, up to block $n$, which has $n$ terms. The position in the sequence of the last term of each block is obtained by summing all the numbers from 1 to the number assigned to the block. For example, as can be counted in the enumeration above,

- the last 3 in block 8 is the $36^{\text{th}}$ term, since $1+2+3+4+5+6+7+8=36$.
- the last 1 in block 11 is the $66^{\text{th}}$ term, since $1+2+3+\cdots+10+11=66$.

In general, the last term of the $n$-th block is in the position $1+2+3+\cdots+n$. To calculate the value of this sum, we recall that $1,2,3, \ldots, n$ is an arithmetic progression with a common difference of 1, the first term $a_{1}=1$, and the $n$-th term $a_{n}=n$. The sum of its first $n$ terms is then,

$$
1+2+3+4+\cdots+n=\frac{n\left(a_{1}+a_{n}\right)}{2}=\frac{n(n+1)}{2}
$$

Now we need to determine in which block the hundredth term of the sequence is located. Assuming it is in the $n$-th block, its position will be, at most, that of the last term of this block. Since it will not be in the $(n+1)$-th block, we conclude that $n$ is the smallest integer such that $100 \leq \frac{1}{2} n(n+1)$, or equivalently, $200 \leq n(n+1)$.

To determine this value of $n$, we need to solve this inequality and choose, among its solutions, the smallest integer. Since the expression is quite simple, it is easier to solve it by trial. Doing so, we see that $n=14$. Indeed, $13 \times (13+1) = 182 < 200$. Thus, the hundredth term of the sequence is in block 14. The numbers that appear in the blocks repeat every five, in the order 1, 2, 3, 4, and 5. Since $14 = 5 \times 2 + 4$, block 14 is formed by the number 4. Therefore, the hundredth term of the sequence is 4.

Note: The above solution to the inequality $200 \leq n(n+1)$, although correct, would not serve if the problem asked, for example, to determine the 10000th term of the sequence. In that case, we would have to deal with the inequality $20000 \leq n(n+1)$, and, of course, finding its smallest integer solution by trial does not seem promising (unless with a lot, a lot of luck!). Therefore, let's solve the inequality $200 \leq n(n+1)$ in a way that works in general.

We start by writing $200 \leq n(n+1)$ as $n^{2}+n-200 \geq 0$.

This leads us to the study of the sign of the quadratic function $f(x)=x^{2}+x-200$, whose graph is illustrated in the figure. The roots of $f(x)$ are

$$
\begin{aligned}
& x_{1}=\frac{-1-\sqrt{1+800}}{2} \\
& x_{2}=\frac{-1+\sqrt{1+800}}{2}
\end{aligned}
$$

![](https://cdn.mathpix.com/cropped/2024_05_01_30c9a294a58a6e4b8190g-045.jpg?height=466&width=623&top_left_y=1843&top_left_x=1256)

Notice that $x_{1}$ is negative and $x_{2}$ is approximately equal to 13.6. Since $f(x) \geq 0$ for $x \leq x_{1}$ and $x \geq x_{2}$, it follows that the $n$ we are looking for is the smallest integer that is greater than or equal to $x_{2}$, i.e., $n=14$.

Now, if we wanted to determine the 10000th term of the sequence, we could simply repeat the above procedure, finding $x_{2}=\frac{1}{2}[-1+\sqrt{1+80000}]$, which is approximately equal to 140.9. Therefore, $n=141$ and the 10000th term of the sequence is in the 141st block. Since $141=28 \times 5+1$, it follows that the 10000th term is 1.