Random Post
Recent Posts
Recent Comments
Archives
Categories
- article (11)
- enigma (1,609)
- enigma-book-1982 (70)
- misc (5)
- project euler (2)
- puzzle (90)
- puzzle# (173)
- site news (76)
- tantalizer (189)
- teaser (7)
- today (1)
Site Stats
- 310,314 hits
Programming Enigma Puzzles
From New Scientist #1815, 4th April 1992 [link]
I have ten volumes of Applications of Abstract Algebra together in order on my shelves. Each volume has 100 pages and the page numbering continues through the volumes from 1 to 1000.
A bookworm started to nibble through the even-numbered side of a leaf (whose number was a perfect square): it kept nibbling in a straight line — through covers as well — and when it stopped it had just emerged through a leaf onto its odd-numbered side (whose number was also a perfect square). Ignoring the covers, it had eaten through a number of leaves which was also a perfect square.
What were those three squares?
[enigma660]
The key thing to note with this kind of puzzle is that when books are placed on shelves, the spine is usually placed facing out, so that the pages of a book numbered 1/2, 3/4, 5/6, …, 99/100 when placed on the shelf would be positioned (left to right): 100/99, 98/97, …, 2/1.
So if all 10 volumes are stacked left (vol 1) to right (vol 10), the pages will go:
The bookworm starts on an even page number and eats through leaves from left right and ends on an odd number in a different volume.
This Python program runs in 60ms. (Internal run time is 311µs).
Run: [ @replit ]
Solution: The three squares are: 16 (start page), 289 (finish page), 64 (number of leaves chomped).