Skip to content

← Math Further 6–8

How Many Days Does the Snail Take to Climb Out of the Well?

Topic 45 · Grades 6–8 · Counting carefully: fence posts, the last step and off-by-one

What this builds on from class
In this unit 10 sections
  1. Try it
  2. What’s going on
  3. Posts and gaps
  4. From day 3 to day 10
  5. Pages and digits
  6. Count without missing any
  7. Round and round until it repeats
  8. Where this is used
  9. Questions
  10. Where to go next

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

The snail in the well

Press Next to move half a day at a time: a day of climbing, then a night of sliding. Watch the zigzag on the right, and the dashed line of “1 meter a day”.

0246810height (m)top of the well, 10 m12345678day
Depth of the well:
Day
1
Height
0 m
Nights slid back
0

Morning of day 1: the snail is at the bottom. Each day it climbs 3 m; each night it slides back 2 m.

Evening of day 1: it has climbed to 0 m. Tonight it will slide back 2 m.

Morning of day 1: after the night it is at 0 m, 1 m higher than the morning before.

Out on day 1! The very first climb reached the top: not a single night in the well.

Out on day 8! That day’s climb reached the top, so there was no night to slide back: 8 days, but only 7 nights.

Morning of day 13, and it is back at the bottom, as on every morning: it slides back as far as it climbs, so it never gets out.

Snail: Pearson Scott Foresman, Public domain, via Wikimedia Commons

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.

  1. 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.
  2. 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.

Try it

When the snail slides back as far as it climbs

Press Jump to the end. Every morning the snail is back at 0 m: the zigzag goes up and down but never gets anywhere.

0246810height (m)top of the well, 10 m136912day
Day
1
Height
0 m
Nights slid back
0

Morning of day 1: the snail is at the bottom. Each day it climbs 3 m; each night it slides back 3 m.

Evening of day 1: it has climbed to 0 m. Tonight it will slide back 3 m.

Morning of day 1: after the night it is at 0 m, 0 m higher than the morning before.

Out on day 1! The very first climb reached the top: not a single night in the well.

Out on day 0! That day’s climb reached the top, so there was no night to slide back: 0 days, but only -1 nights.

Morning of day 13, and it is back at the bottom, as on every morning: it slides back as far as it climbs, so it never gets out.

Snail: Pearson Scott Foresman, Public domain, via Wikimedia Commons

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.

1234567893 m24 m in all: 8 gaps, 9 postspost 1gap 16garden12 m × 12 mround it: 48 ma post every 3 m16 gaps, 16 poststhe last gap endsat post 1
Figure 45.1 Above, a straight fence 24 m long with a post every 3 m: 8 gaps and 9 posts, one more post than gaps. Below, a fence all round a square garden with sides of 12 m: 48 m of fence, 16 gaps and 16 posts. Going round, the last gap ends at the first post.

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.

Try it

Every triangle, once

Five lines come down from the top corner to the base. Press Next triangle to list the triangles in order, and watch the table fill. Then add a crossbar and count again.

ABCDEF
Triangles found: left side down, right side across
left sideACADAEAF
AB····
AC···
AD··
AE·
Triangles listed
0
Lines across
1

A triangle here has two of the five lines from A as its sides. Press Next triangle to list them, left side first.

Triangle 1: sides AB and AC, closed by the base.

Triangle 2: sides AB and AD, closed by the base.

Triangle 3: sides AB and AE, closed by the base.

Triangle 4: sides AB and AF, closed by the base.

Triangle 5: sides AC and AD, closed by the base.

Triangle 6: sides AC and AE, closed by the base.

Triangle 7: sides AC and AF, closed by the base.

Triangle 8: sides AD and AE, closed by the base.

Triangle 9: sides AD and AF, closed by the base.

Triangle 10: sides AE and AF, closed by the base.

All 10: 4 with AB as the left side, then 3, 2 and 1. Each is one pair of the five lines.

All 20: each of the 10 pairs of lines makes two triangles, one closed by the crossbar and one by the base.

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.★

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
b.★

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
c.★★

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
d.★★

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
e.★★

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.

f.★★

How many times is the digit 7 written when you write all the numbers from 1 to 100?

Hint
Answer
g.★★

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
h.★★★

Can the pages of a book be numbered from 1 using exactly 500 digits?

Hint
Answer
i.★★★

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
j.★★★

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

Where these facts come from
  • Fibonacci’s lion in the pit (50 palms, 17 \tfrac{1}{7} up, 19 \tfrac{1}{9} 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.