Resources For Teachers For Tutors For Students & Parents AI New Pricing
Year 5 Maths Whole Numbers & Place Value

Algorithms with factors & multiples

20 practice questions 0 video lessons Theory + worked examples
Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

An algorithm is a set of steps that always gives the right answer if you follow it exactly. This Year 5 maths page shows algorithms and flow charts that test whether one number is a factor or multiple of another, algorithms that repeat steps to list factors and multiples, a sieve for finding prime numbers, and how to find the highest common factor and lowest common multiple.

An algorithm is a list of steps carried out in order. Some steps make a decision (a yes or no question) that decides which step comes next. Some steps are repeated until a condition is met.

A flow chart draws an algorithm with boxes and arrows. A diamond holds a yes or no question, with one arrow for each answer.

\(a\) is a factor of \(b\) when \(b \div a\) has no remainder. Then \(b\) is a multiple of \(a\).

A prime number can only be made as \(1 \times\) itself, so it has exactly two factors, like \(13\). A number with more than two factors, like \(15\), is called composite. The number \(1\) is neither.

The highest common factor (HCF) of two numbers is the largest number that divides both. The lowest common multiple (LCM) is the smallest number that both divide.

Flow chart testing whether 8 is a factor of 56 Start: is 8 a factor of 56? Divide 56 by 8. Decision: is the remainder 0? Yes leads to 8 is a factor of 56; no leads to 8 is not a factor. 56 divided by 8 is 7 remainder 0, so the yes path is followed. Is 8 a factor of 56? Divide 56 by 8 remainder = 0? 8 is a factor of 56 8 is not a factor YesNo
\(56 \div 8 = 7\) remainder \(0\), so follow the Yes arrow: \(8\) is a factor of \(56\).
Sieve of Eratosthenes from 1 to 50 A grid of the numbers 1 to 50. The prime numbers 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47 are shaded. 1 and every composite number are crossed out. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
A sieve to \(50\): cross out \(1\), then the multiples of \(2\), \(3\), \(5\) and \(7\) (but not the numbers themselves). The shaded numbers left are prime.

The tests behind these algorithms:

\[ 56 \div 8 = 7 \text{ r } 0 \ \Rightarrow\ 8 \text{ is a factor of } 56 \]
56÷8=7
\[ 60 \div 9 = 6 \text{ r } 6 \ \Rightarrow\ 9 \text{ is not a factor of } 60 \]
60÷9=6 r 6
Branching. A decision splits the algorithm into two paths. The answer to the question chooses the path.
Repeating. A loop sends you back to an earlier step. Every loop needs a stopping rule, such as “stop when the number is bigger than 50”.
Something to try. For \(10\) and \(15\) the HCF is \(5\) and the LCM is \(30\). Multiply them: \(5 \times 30 = 150\), the same as \(10 \times 15\).

Algorithm: is \(a\) a factor of \(b\)?

  1. Divide \(b\) by \(a\).
  2. Is the remainder \(0\)? If yes, \(a\) is a factor of \(b\) and \(b\) is a multiple of \(a\).
  3. If no, \(a\) is not a factor and \(b\) is not a multiple of \(a\).

Algorithm: list the multiples of \(a\) up to a limit

  1. Start with \(a\).
  2. Add \(a\) to get the next multiple.
  3. Repeat step 2 until the next number would pass the limit.

Algorithm: highest common factor and lowest common multiple

  1. HCF: list the factors of both numbers and take the largest number in both lists.
  2. LCM: list multiples of the larger number until you reach one that the smaller number divides exactly.
Example 1 — Follow a flow chart
Use the factor test to decide whether \(9\) is a factor of \(60\).
Solution
\(60 \div 9\)\(=\)\(6 \text{ r } 6\)
\(\text{remainder} = 0?\)\(:\)\(\text{No}\)
60÷9=6 r 6

Follow the No arrow: \(9\) is not a factor of \(60\).

Example 2 — Multiple test
Use the algorithm to decide whether \(63\) is a multiple of \(7\).
Solution
\(63 \div 7\)\(=\)\(9 \text{ r } 0\)
\(\text{remainder} = 0?\)\(:\)\(\text{Yes}\)
63÷7=9

Yes, \(63\) is a multiple of \(7\), because \(7 \times 9 = 63\).

Example 3 — A repeating algorithm
Start at \(7\). Add \(7\) each time. Stop before passing \(60\).
(i) Which numbers are written?
(ii) How many multiples of \(7\) are between \(1\) and \(60\)?
Solution
\(7,\ 14,\ 21,\ 28\)\(,\)\(35,\ 42,\ 49,\ 56\)
\(56 + 7\)\(=\)\(63 > 60 \text{ (stop)}\)
7×8=56

(i) \(7,\ 14,\ 21,\ 28,\ 35,\ 42,\ 49,\ 56\).
(ii) \(8\).

Example 4 — Prime or composite?
Is \(39\) prime or composite?
Solution
\(39 \div 3\)\(=\)\(13\)
39=3×13

\(39 = 3 \times 13\), so it has more than two factors (\(1,\ 3,\ 13,\ 39\)). It is composite.

Example 5 — Highest common factor
Find the highest common factor of \(28\) and \(42\).
Solution
\(28\)\(:\)\(1,\ 2,\ 4,\ 7,\ 14,\ 28\)
\(42\)\(:\)\(1,\ 2,\ 3,\ 6,\ 7,\ 14,\)
\(\)\(\)\(21,\ 42\)
HCF =14

The common factors are \(1,\ 2,\ 7,\ 14\). The HCF is \(14\).

Example 6 — Lowest common multiple
Two lights flash together at 8 pm. One flashes every \(6\) seconds and the other every \(15\) seconds. After how many seconds do they next flash together?
Solution
\(\text{multiples of } 15\)\(:\)\(15,\ 30\)
\(30 \div 6\)\(=\)\(5\)
LCM of 6 and 15=30

The LCM of \(6\) and \(15\) is \(30\), so they flash together again after \(30\) seconds.

Example 7 — Sharing into baskets
A teacher has \(20\) pens and \(30\) pencils. She makes identical packs using all of them. What is the greatest number of packs?
Solution
\(\text{HCF of } 20 \text{ and } 30\)\(=\)\(10\)
\(20 \div 10,\ 30 \div 10\)\(:\)\(2,\ 3\)
HCF of 20 and 30=10

\(10\) packs, each with \(2\) pens and \(3\) pencils.

Example 8 — HCF times LCM
For \(10\) and \(15\):
(i) find the HCF
(ii) find the LCM
(iii) multiply your answers.
Solution
\(\text{HCF}\)\(=\)\(5\)
\(\text{LCM}\)\(=\)\(30\)
\(5 \times 30\)\(=\)\(150\)
5×30=150

(i) \(5\).
(ii) \(30\).
(iii) \(150\), the same as \(10 \times 15\).

Common pitfalls

Skipping a step. An algorithm only works if every step is followed in order. Do not guess the answer to a decision: work it out.
Factor and multiple the wrong way round. \(8\) is a factor of \(56\); \(56\) is a multiple of \(8\). A smaller number cannot be a multiple of a bigger one.
Calling 1 prime. A prime has exactly two factors. \(1\) has only one factor, so it is not prime.
HCF or LCM? Sharing into equal groups uses the highest common factor. Things happening together again uses the lowest common multiple.

Frequently asked questions

What is an algorithm?

An algorithm is a set of steps that you follow in order to solve a problem. It can include decisions and steps that repeat.

How do you test whether one number is a factor of another?

Divide. If the remainder is \(0\), it is a factor. \(56 \div 8 = 7\) with no remainder, so \(8\) is a factor of \(56\).

What does the diamond in a flow chart mean?

A diamond holds a yes or no question. You follow the arrow that matches your answer.

What is a prime number?

A prime number has exactly two factors, \(1\) and itself. \(2,\ 3,\ 5,\ 7\) and \(11\) are prime.

What is the highest common factor?

It is the largest number that divides both numbers exactly. The HCF of \(28\) and \(42\) is \(14\).

What is the lowest common multiple?

It is the smallest number that is a multiple of both numbers. The LCM of \(6\) and \(15\) is \(30\).