Algorithms generating number sets
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.
Rules that build a set
| Start | Rule | Set |
|---|---|---|
| \(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\) |
How to use an algorithm
- Start with the first term, or the input.
- Apply the rule to it to get the next term.
- Repeat by feeding each result back in and applying the rule again.
- To find a rule, compare each term with the next: equal gaps mean add or subtract, growing gaps mean multiply.
Apply the rule to the input.
| \(8 + 5\) | \(=\) | \(13\) |
The output is \(13\).
The gap is \(11-4=7\), so the rule adds \(7\).
| \(25 + 7\) | \(=\) | \(32\) |
The next term is \(32\).
Each term is double the one before.
| \(24 \times 2\) | \(=\) | \(48\) |
The next term is \(48\).
Do the steps in order.
| \(6 \times 2\) | \(=\) | \(12\) |
| \(12 - 1\) | \(=\) | \(11\) |
The output is \(11\).
Common pitfalls
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\).