Task B-4.5. The pages of a book are numbered 1, 2, 3, .., n. One sheet has been torn out of the book. The sum of the numbers on the remaining pages is 2013. How many pages does the book have and which pages are missing?
Solution. Let $n$ denote the number of pages in the book, and let $k$ and $k+1$ be the page numbers on the torn-out sheet. We have

$$
2013=1+2+\ldots+k-1+k+2+\ldots+n=\frac{n(n+1)}{2}-k-(k+1)
$$

Estimate the upper and lower bounds for the sum on the right side of the equation.

Obviously, $1 \leq k \leq n-1$, so we have the system of inequalities:

$$
\begin{aligned}
2013 & \leq \frac{n(n+1)}{2}-1-2 \\
2013 & \geq \frac{n(n+1)}{2}-(n-1)-n
\end{aligned}
$$

From this, we get a system of two quadratic inequalities:

$$
\begin{array}{r}
n^{2}+n-4032 \geq 0 \\
n^{2}-3 n-4024 \leq 0
\end{array}
$$

If $n_{1}<n_{2}$ are the solutions to the equation $n^{2}+n-4032=0$ and $n_{3}<n_{4}$ are the solutions to the equation $n^{2}-3 n-4024=0$, it follows that $n \in\left[n_{2}, n_{4}\right]$ (since it is easy to see that $n_{1}$ and $n_{3}$ are negative). We have:

$$
\begin{aligned}
& n_{2}=\frac{-1+\sqrt{1+4 \cdot 4032}}{2}=\frac{-1+\sqrt{16129}}{2}=\frac{-1+\sqrt{127^{2}}}{2}=63 \\
& n_{4}=\frac{3+\sqrt{9+4 \cdot 4024}}{2}=\frac{3+\sqrt{16105}}{2}<\frac{3+\sqrt{127^{2}}}{2}=65
\end{aligned}
$$

Thus, $n$ is either 63 or 64.

If $n=63$, we solve the equation

$$
\begin{aligned}
& \frac{63 \cdot 64}{2}-k-(k+1)=2013 \\
& 2016-2 k-1=2013 \\
& 2 k=2 \\
& k=1
\end{aligned}
$$

and the solution is $n=63, k=1$.

If $n=64$, we solve

$$
\begin{aligned}
& \frac{64 \cdot 65}{2}-k-(k+1)=2013 \\
& 2080-2 k-1=2013 \\
& 2 k=66 \\
& k=33
\end{aligned}
$$

and the solution is $n=64, k=33$.

Therefore, either the first and second pages were torn out from a book with 63 pages, or the 33rd and 34th pages were torn out from a book with 64 pages.