A printing company agreed to publish a book about Western history. When they were numbering the pages of the book, they noticed that they used 2989 digits. How many pages long was the book they agreed to publish?

To determine the number of pages in the book, we need to understand the relationship between the number of pages and the number of digits.

In a book, each page number consists of one or more digits. The following patterns explain how the number of digits changes as the page numbers increase:

1-digit page numbers: 1-9 (9 pages, 9 digits)
2-digit page numbers: 10-99 (90 pages, 180 digits)
3-digit page numbers: 100-999 (900 pages, 2700 digits)
4-digit page numbers: 1000-9999 (9000 pages, 36000 digits)

By analyzing this pattern, we can observe that:
- The first 9 pages consist of 9 digits (1-digit page numbers).
- The next 90 pages contain 180 digits (2-digit page numbers).
- The subsequent 900 pages contain 2700 digits (3-digit page numbers).
- The remaining pages, starting from the 1000th page, contain 4-digit page numbers.

Now, to find the number of pages in the book, we need to compare the number of digits used (2989) with the cumulative digits for each number of pages.

The cumulative digits can be calculated as follows:
Number of cumulative digits =
(9 * 1) + (90 * 2) + (900 * 3) + (X * 4)

We need to determine the value of 'X' in order to find the number of pages that contains "2989" digits.

Let's calculate the cumulative digits and solve for 'X':

Cumulative digits =
(9 * 1) + (90 * 2) + (900 * 3) + (X * 4)
= 9 + 180 + 2700 + 4X
= 2889 + 4X

To find 'X', we need to solve the equation:
2889 + 4X = 2989

Subtracting 2889 from both sides:
4X = 100

Dividing both sides by 4:
X = 25

Therefore, the book contains 25 pages with 4-digit page numbers.

To calculate the total number of pages, we sum up the pages from the four groups:
- 9 pages with 1-digit numbers
- 90 pages with 2-digit numbers
- 900 pages with 3-digit numbers
- 25 pages with 4-digit numbers

Total number of pages = 9 + 90 + 900 + 25 = 1024

Therefore, the book they agreed to publish is 1024 pages long.