Resources For Teachers For Tutors For Students & Parents Pricing
Primary - Stage 3 (Year 5 & 6) Stage 3 (Year 5 & 6) Patterns & Rules

Algorithms generating number sets

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 rule applied again and again: start with a number, then use the same rule to build a set of numbers, one term at a time.

An algorithm is a rule you apply again and again to build a set of numbers.

Start with a start value, then use the same rule on each term to make the next one.

Start at \(3\) and add \(4\) each time gives \(3,\ 7,\ 11,\ 15,\ \dots\)

A function machine shows this as an input, a rule, and an output.

Number set 3, 7, 11, 15 built by adding 4 each time Four boxes showing 3, 7, 11 and 15. A curved plus 4 arrow joins each box to the next, so the same rule builds every term. 37 1115 +4+4+4
Start at \(3\), add \(4\) each time: \(3,\ 7,\ 11,\ 15,\ \dots\) The same rule builds every new term.

Rules that build a set

StartRuleSet
\(3\)add \(4\)\(3,\ 7,\ 11,\ 15\)
\(40\)subtract \(6\)\(40,\ 34,\ 28,\ 22\)
\(1\)double\(1,\ 2,\ 4,\ 8\)
\(6\)\(\times 2\) then \(-1\)\(6,\ 11,\ 21,\ 41\)
Equal gaps add or subtract; gaps that grow quickly multiply. Check the rule works between every pair of terms.

How to use an algorithm

  1. Start with the first term, or the input.
  2. Apply the rule to it to get the next term.
  3. Repeat by feeding each result back in and applying the rule again.
  4. To find a rule, compare each term with the next: equal gaps mean add or subtract, growing gaps mean multiply.
Example 1 — Function machine
A machine has the rule “\(+5\)”. The input is \(8\). What is the output?
Solution

Apply the rule to the input.

\(8 + 5\)\(=\)\(13\)

The output is \(13\).

Example 2 — Find the next term
Continue \(4,\ 11,\ 18,\ 25,\ \dots\)
Solution

The gap is \(11-4=7\), so the rule adds \(7\).

\(25 + 7\)\(=\)\(32\)

The next term is \(32\).

Example 3 — Multiply each time
Continue \(3,\ 6,\ 12,\ 24,\ \dots\)
Solution

Each term is double the one before.

\(24 \times 2\)\(=\)\(48\)

The next term is \(48\).

Example 4 — Two-step rule
A machine does “\(\times 2\) then \(-1\)”. The input is \(6\). What is the output?
Solution

Do the steps in order.

\(6 \times 2\)\(=\)\(12\)
\(12 - 1\)\(=\)\(11\)

The output is \(11\).

Common pitfalls

Apply the rule to the last term. Each new term feeds back in; do not keep starting from the first number.
Match the operation. Equal gaps mean add or subtract; gaps that grow quickly mean multiply.
Two-step rules keep their order. “\(\times 2\) then \(+1\)” is not the same as “\(+1\) then \(\times 2\)”.

Frequently asked questions

What is an algorithm in maths?

It is a rule, or set of steps, that you follow in the same order every time. Applying it again and again builds a set of numbers.

What is a function machine?

A function machine takes an input, applies a rule such as \(+5\) or \(\times 3\), and gives an output.

How do I find the rule of a number set?

Compare each term with the next. If the gaps are equal the rule adds or subtracts; if the terms grow quickly the rule multiplies.

Does the order of a two-step rule matter?

Yes. “\(\times 2\) then \(+1\)” on \(4\) gives \(9\), but “\(+1\) then \(\times 2\)” gives \(10\).

How do I run a machine backwards?

Undo each step with the opposite operation, working from the last box first. To undo “add \(7\)”, subtract \(7\).