A number from its remainders

The question

Some marbles are shared out in different sized bags. In bags of 5, 1 is left over. In bags of 8, 4 are left over.

What is the smallest number of marbles there could be?

Climb one list until it fits the others

÷5leaves1
÷8leaves4
1611162126
16111621…36
36
  1. We know the leftovers: divided by 5 it leaves 1 and divided by 8 it leaves 4.
  2. Take the conditions one at a time, starting with the first. The numbers that leave 1 when divided by 5 are 1, 6, 11, 16, 21, 26 and so on — going up in 5s.
  3. Now walk up that list in 5s until one of them also leaves 4 when divided by 8: 1, 6, 11, 16, … do not, and 36 does.
  4. So the smallest is 36 marbles. Check every condition: 5 × 7 = 35, leaving 1 and 8 × 4 = 32, leaving 4.

How it works.

  1. 01

    We know the leftovers: divided by 5 it leaves 1 and divided by 8 it leaves 4.

  2. 02

    Take the conditions one at a time, starting with the first. The numbers that leave 1 when divided by 5 are 1, 6, 11, 16, 21, 26 and so on — going up in 5s.

  3. 03

    Now walk up that list in 5s until one of them also leaves 4 when divided by 8: 1, 6, 11, 16, … do not, and 36 does.

  4. 04

    So the smallest is 36 marbles. Check every condition: 5 × 7 = 35, leaving 1 and 8 × 4 = 32, leaving 4.