Behind Tenzing’s grandmother’s house in Kavre is an old stone well, 10 meters deep and dry all winter. One morning he sees a snail at the very bottom, starting up the damp wall. All day it climbs, and by evening it is 3 meters higher. All night it sleeps, and slides back 2 meters.
“Three up, two down: 1 meter a day,” says Tenzing. “It will be out on the tenth day.” His cousin Sanskriti shakes her head. “Count again.”
(The snail is out the moment it reaches the top: over the rim, it has no well to slide back down.)
Guess first. On which day does the snail climb out?
Pick an answer to see why.
Try it
Day by day
Here is the snail’s diary, the same as the widget’s. Read across each row.
| Day | Morning | Evening (after climbing 3 m) | After the night (2 m back) |
|---|---|---|---|
| 1 | 0 m | 3 m | 1 m |
| 2 | 1 m | 4 m | 2 m |
| 3 | 2 m | 5 m | 3 m |
| 4 | 3 m | 6 m | 4 m |
| 5 | 4 m | 7 m | 5 m |
| 6 | 5 m | 8 m | 6 m |
| 7 | 6 m | 9 m | 7 m |
| 8 | 7 m | 10 m: out! | no night in the well |
- a.Look at the morning column. How much higher is the snail each morning than the morning before?
- b.Look at the evening column. On the evening of day 7 the snail is at 9 m. How far is it then from the top, and how far will it climb the next day?
- c.The snail climbs on 8 days. On how many nights does it slide back?
Tenzing was right that the snail gains 1 meter for each full day and night. His mistake is about the end: the snail only needs to start a morning within 3 meters of the top, and then it climbs out before the night comes.
Wells of other depths
Now try the same snail, 3 up and 2 down, in shallower wells, and find a pattern. In the widget, choose the well’s depth.
| Depth of the well | 3 m | 4 m | 5 m | 6 m | 7 m | 8 m | 9 m | 10 m |
|---|---|---|---|---|---|---|---|---|
| Day it climbs out | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
A 3-meter well takes one day, since the very first climb reaches the top. Every meter deeper adds a day. So for this snail, the day is always 2 less than the depth, as long as the well is at least 3 meters deep.
The same snail falls into a 20-meter well. On which day does it climb out?
Pick an answer to see why.
What’s going on
Take off the last day first
Here is a way to count that never trips. Think about the end first.
- On its last day, the snail climbs and does not slide. So that day it can start as far as 3 meters below the top, and still get out. For a 10-meter well, it needs to be 7 meters up on some morning.
- Until then, each day and night together lift it 1 meter. To get 7 meters up takes 7 days and 7 nights.
- Then comes the last day, with no night: 7 + 1 = 8.
The general recipe, in words: take the last climb off the depth; divide what is left by the gain of a whole day and night, rounding up if it doesn’t divide exactly; then add one for the last day.
The aha: check the small case and the last step
How could you have caught Tenzing’s mistake without the diary? Two habits catch almost every counting slip of this kind.
- Try a tiny case you can check by hand. A 3-meter well: “1 meter a day” says 3 days, but the snail is out on the first evening. The rule is wrong, so look for why.
- Look hard at the last step. Most of the steps in a count are alike; the first and the last are where something is different. Here the last day has no night.
Posts and gaps
The bamboo fence
Sanskriti’s family is putting a bamboo fence along one side of the vegetable plot, 24 meters long, with a post every 3 meters, one at each end. How many posts do they need?
24 ÷ 3 = 8, so it is tempting to buy 8 posts. But 8 is the number of gaps between the posts. Each gap comes with the post at its right-hand end, and the very first post has no gap before it. So there is one more post than gaps: 9 posts.
Now put a fence all the way round a square garden 12 meters on each side, again with a post every 3 meters. The fence is 4 × 12 = 48 meters long, so it has 48 ÷ 3 = 16 gaps. But this time, going round, the last gap ends at the first post, which is already there (Figure 45.1). In a ring, posts and gaps are equal: 16 posts.
This slip has a name. Counting the gaps when you mean the posts, or the posts when you mean the gaps, is a fencepost error, and any count that comes out one too many or one too few is an off-by-one error.
| The things | In a line | In a ring |
|---|---|---|
| posts and gaps | posts = gaps + 1 | posts = gaps |
| trees along a road and the spaces between them | trees = spaces + 1 | — |
| beads on a string, and on a bangle | — | beads = gaps |
The snail was a fence too
Look again at the snail’s diary: 8 days of climbing and 7 nights of sliding. The days are the posts, and the nights are the gaps between them. A straight fence has one more post than gaps, so the snail has one more day than nights. Tenzing counted the snail as if each day came with a night after it, which is like buying a gap for every post.
A house in Bhaktapur has a ground floor and three floors above it. How many flights of stairs do you climb from the ground floor to the top floor?
Pick an answer to see why.
From day 3 to day 10
Counting both ends
The school’s exams run from Baisakh 3 to Baisakh 10, both days included. How many days of exams is that?
10 − 3 = 7 is the number of gaps: the steps from one date to the next, as on a number line. The days themselves are the posts, and a line of posts has one more: 8 days. Write them out if you doubt it: 3, 4, 5, 6, 7, 8, 9, 10.
So a count from a to b, both included, has b − a + 1 things in it. Reading “from page 47 to page 62” is 62 − 47 + 1 = 16 pages, not 15.
How many two-digit numbers are there, from 10 to 99?
Pick an answer to see why.
Pages and digits
How many digits does a book use?
A printer numbers the pages of a 120-page book, 1 to 120. How many digits does she print?
Count the numbers by how many digits they have, and be careful with each group’s two ends:
| Pages | How many pages | Digits each | Digits |
|---|---|---|---|
| 1 to 9 | 9 − 1 + 1 = 9 | 1 | 9 |
| 10 to 99 | 99 − 10 + 1 = 90 | 2 | 180 |
| 100 to 120 | 120 − 100 + 1 = 21 | 3 | 63 |
| all | 120 | 252 |
The page counts add up to 120, a good check that no group lost or gained a page.
Count without missing any
Triangles in a fan
Here is a puzzle that often comes up in competitions: how many triangles are in a picture? Counting by eye nearly always misses some or counts some twice. The cure is a system, an order that lists each one once.
Every triangle in the fan has the top corner as one corner, and its two sides are two of the five lines from the top. Its third side is the base. So a triangle is a choice of two of the five lines, a left one and a right one. List them left side first: with the first line as the left side there are 4 choices of right side, then 3, then 2, then 1, and 4 + 3 + 2 + 1 = 10 triangles. It is the same count as the handshakes among 5 people.
Add a crossbar across the fan, parallel to the base, and every pair of lines now makes two triangles, one ending at the crossbar and one at the base: 2 × 10 = 20.
Squares on a board
How many squares are there on a 4 × 4 board? Not 16: the big ones count too. Sort them by size, and count where each size can sit.
| Size of square | Positions across | Positions down | Squares |
|---|---|---|---|
| 1 × 1 | 4 | 4 | 16 |
| 2 × 2 | 3 | 3 | 9 |
| 3 × 3 | 2 | 2 | 4 |
| 4 × 4 | 1 | 1 | 1 |
| all | 30 |
A 2 × 2 square can start in column 1, 2 or 3 of the four, one fewer than there are columns: posts and gaps again. The total is 16 + 9 + 4 + 1, the square numbers.
Round and round until it repeats
The perfect shuffle
Sandesh has 8 cards numbered 1 to 8. He cuts them into two halves of 4, then puts them together perfectly, one card from each half in turn, keeping card 1 on top. It is called an out-shuffle. How many out-shuffles bring the cards back to 1, 2, 3, …, 8?
There is no shortcut yet: play it, and write down each order until one repeats.
| After | Order of the cards |
|---|---|
| no shuffles | 1 2 3 4 5 6 7 8 |
| 1 shuffle | 1 5 2 6 3 7 4 8 |
| 2 shuffles | 1 3 5 7 2 4 6 8 |
| 3 shuffles | 1 2 3 4 5 6 7 8 |
Three shuffles, and the cards are back. The table has four rows, but the first is the start, not a shuffle: the rows are the posts, the shuffles the gaps. And once an order comes back, everything after it repeats, every three shuffles, forever. That is the same cycle idea as in What Is the Last Digit of 3 to the Power 100?
Where this is used
Questions
★ A straight fence 30 m long has a post every 5 m, one at each end. How many posts does it have?
Pick an answer to see why.
A frog falls into a well 12 m deep. Each day it jumps up 4 m, and each night it slips back 1 m. On which day is it out?
Hint
Answer
Trees are planted on both sides of a straight road 200 m long, every 10 m, with a tree at each end of each side. How many trees are planted?
Hint
Answer
Kriti reads a novel from page 120 to page 155, both included, at 4 pages a day. How many days does she take?
Hint
Answer
A lizard climbs a wall 25 m high. It climbs 7 m each day and slips 4 m each night. On which day does it reach the top?
Hint
Answer
A snail climbs 5 m each day and slides back 3 m each night. It gets out of a well on day 6, and not before. The well is a whole number of meters deep. What is the deepest it can be?
Hint
Answer
★★ How many squares, of all sizes, are on a board 3 squares wide and 2 squares high?
Pick an answer to see why.
How many times is the digit 7 written when you write all the numbers from 1 to 100?
Hint
Answer
Soyana and four friends stand in a ring for a counting-out rhyme of 12 beats. Soyana starts the rhyme by pointing at herself on the first beat, and they go round to the left. Who is out?
Hint
Answer
Can the pages of a book be numbered from 1 using exactly 500 digits?
Hint
Answer
Draw a fan of 4 lines from the top corner of a triangle down to its base (the two sides and two lines between), and 2 crossbars parallel to the base. How many triangles are there?
Hint
Answer
Shuffle 6 cards, 1 to 6, by perfect out-shuffles (cut into 3 and 3, then one card from each half in turn, card 1 staying on top). How many shuffles bring them back to 1, 2, 3, 4, 5, 6?
Hint
Answer
Where to go next
- How Many Handshakes at a Party of 30? Choosing two from a group, the count behind the triangles in a fan.
- How Many Ways Can You Walk to School? Counting routes on a map without listing them, one corner at a time.
- What Is the Last Digit of 3 to the Power 100? Things that come round in a cycle, and where a cycle starts.
- How Long Does a Train Take to Cross a Bridge? The train’s own length is the “last step” of that puzzle.
- What Is the Biggest Number a Computer Can Count To? (Computing, Going Further) Why the biggest number is always one less than the number of patterns.
- Grade 6, Whole Number: the counting and dividing behind every answer here.
Where these facts come from
- Fibonacci’s lion in the pit (50 palms, up, down, his 1,575 days by the 63-day reasoning, the true 1,571 8/9 days), Jacopo da Firenze (1307, by day and by night), Paolo dell’Abbaco, Francesco Calandri (1491), Adam Ries’s snail (1522, the right answer in 1525 by a method still not right), Singmaster’s record of the copies (cited by Slisko) and Vera Sanford’s link to Mahavira’s ship (about 850): Josip Slisko, “What students can learn from Fibonacci’s error in solving ‘The lion in the pit’ problem”, Góndola, Enseñanza y Aprendizaje de las Ciencias 15(2), 2020, pp. 216–238, revistas.udistrital.edu.co, read November 2026.
- Vitruvius on the columns of a temple (Book III, chapter 4, § 3) and the quotation: The Ten Books on Architecture, translated by Morris Hicky Morgan (1914, public domain), Wikisource, read November 2026; when it was written (probably 30–20 BC): Wikipedia, “De architectura”, read November 2026.
- The fencepost error and Vitruvius as an early example; the Julian calendar’s leap years as an inclusive-counting error; off-by-one errors in loops and in a string one byte too long: Wikipedia, “Off-by-one error”, read November 2026.
- The Julian calendar from 45 BC, leap days every three years, Macrobius’s account (the leap day put at the start of each fourth year instead of after its end; 12 instead of 9 in 36 years) and Augustus’s 12 years without one: Wikipedia, “Julian calendar”, read November 2026.
- Out-shuffles and in-shuffles, 8 and 52 for a 52-card deck, “the technique” in magic (Diaconis, Graham and Kantor), and Alex Elmsley’s names for them: Wikipedia, “Faro shuffle”, read November 2026.
range(start, stop)leaving out its stop: Python documentation, “Built-in Types”, Ranges, read November 2026.- Edsger W. Dijkstra, “Why numbering should start at zero” (EWD 831, 11 August 1982): the E.W. Dijkstra Archive, read November 2026.
- Leonardo of Pisa’s Liber Abaci (1202) and the Hindu–Arabic numerals: Wikipedia, “Liber Abaci”, read November 2026.
- Every number, day, count and answer in this topic computed in
checks/textbooks/math-further-6-8/45/tmp/t45_numbers.py(the snail rule checked against a day-by-day count for every well up to 59 m, the triangles by listing every set of three lines).
Found a mistake? Please tell us.
