 # Problem of the Week Problem A and Solution The Pencil Case

## Problem

When trying to solve a mystery involving some missing pencils, you discover the following riddle about the number of pencils that were in the box originally.

There are fewer than forty pencils in the box.

If you remove four pencils at a time, eventually there will be $$2$$ pencils left.

If you remove three pencils at a time, eventually there will be $$0$$ pencils left.

If you remove five pencils at a time, eventually there will be $$0$$ pencils left.

How many pencils were in the box originally? ## Solution

Since there would be $$2$$ pencils left if we remove $$4$$ pencils at a time, it cannot be the case that there are $$0$$ pencils in the box.

From this point, one way to solve this problem is to start with the last clue. From this information, we know that the number of pencils in the box is a multiple of $$5$$. The multiples of $$5$$ that are greater than $$0$$ and less than $$40$$ are: $5,~10,~15,~20,~25,~30,~35$

From the second last clue, we know that the number of pencils in the box is a multiple of $$3$$. The multiples of $$3$$ that are greater than $$0$$ and less than $$40$$ are: $3,~6,~9,~12,~15,~18,~21,~24,~27,~30,~33,~36,~39$

The only two numbers that are in both lists are $$15$$ and $$30$$. Now we can count down by $$4$$ from each to see which one ends up at $$2$$.

Starting at $$15$$ we get this sequence: $$15, 11, 7, 3$$

Starting at $$30$$ we get this sequence: $$30, 26, 22, 18, 14, 10, 6, 2$$

We see that there must have been $$30$$ pencils in the box to start, since this is a multiple of $$5$$ and a multiple of $$3$$ and will have $$2$$ pencils left in the box if we remove $$4$$ at a time.

Teacher’s Notes

The solution provided to this problem essentially uses trial and error to find the answer. We should notice that if we were not given a maximum number of pencils in the box, then there are theoretically an infinite number of answers to this problem. For example if there were $$90$$ pencils in the box, the statements about removing pencils would all be true as well.

If you were to ask a mathematician this question they might solve the problem without using trial and error. They could use congruence notation to represent the information and then solve the problem algebraically.

The statement "If you remove four pencils at a time, eventually there will be $$2$$ pencils left" could be restated as "If you divide the number of pencils in the box by $$4$$, the remainder is $$2$$". If we know congruence notation, we can restate this information as

$p \equiv 2 \mod{4}$

assuming that $$p$$ is the number of pencils in the box. When we read this statement we say that "$$p$$ is congruent to $$2$$, modulo $$4$$".

The other information from the problem could be restated as

$p \equiv 0 \mod{3}$

and

$p \equiv 0 \mod{5}$

Then we can solve this problem algebraically by converting these congruences to linear equations.