# 319 logic/bookworm.p

## Description

This article is from the Puzzles FAQ,
by Chris Cole chris@questrel.questrel.com and Matthew Daly
mwdaly@pobox.com with numerous contributions by others.

# 319 logic/bookworm.p

A bookworm eats from the first page of an encyclopedia to the last

page. The bookworm eats in a straight line. The encyclopedia consists

of ten 1000-page volumes and is sitting on a bookshelf in the usual

order. Not counting covers, title pages, etc., how many pages does the

bookworm eat through?

logic/bookworm.s

On a book shelf the first page of the first volume is on the "inside"

__ __
B| | | |F
A|1 |...........................|10|R
C| | | |O
K| | | |N
| | | |T
----------------------------------

so the bookworm eats only through the cover of the first volume, then 8 times

1000 pages of Volumes 2 - 9, then through the cover to the 1st page of Vol 10.

He eats 8,000 pages.

If the bookworm ate the first page and the last page, it ate 8,004 pages.

Continue to: