In this challenge we are going to apply our programming skills to perform some arithmetic operations. We will use arithmetic operators such as +, – and * as well as for loops to repeat instructions.
Context / Starter activity
A primary teacher likes to start her maths lesson by displaying a number sequence maths challenge on the board. Here are the last three challenges she has used with her class. Can you solve these?
Number Sequence #1:
Number Sequence #2:
Number Sequence #3:
There are different types of number sequences. Let’s investigate the most widely used types of number sequences.
You may want to read this page first: https://www.mathsisfun.com/numberpatterns.html
An Arithmetic Sequence is made by adding the same value each time. When creating an arithmetic number sequence you have to decide of a starting number (e.g. “2”) and an increment (e.g. “3”)
A Geometric Sequence is made by multiplying by the same value each time.
When creating a geometric number sequence you have to decide of a starting number (e.g. “2”) and a multiplier (e.g. “3”)
This sequence consists of calculating the squares of whole numbers.
This sequence is generated by adding an “increasing” number, that is a number that each time is incremented by 1 as we progress through the number sequence. Not clear? Check the diagram below.
The Fibonacci Sequence is found by adding the two numbers before it together.
- The 3 is found by adding the two numbers before it (1+2)
- The 5 is found by adding the two numbers before it (2+3)
- The 8 is found by adding the two numbers before it (3+5)
Edit some of the above scripts to create other number sequences such as:
- Arithmetic sequences using a different starting number and increment,
- Geometric sequences,
- Square numbers sequence.
You can also adapt or even mix these techniques to create your own number sequences!
Adapt your scripts so that the program asks the end-user the question: “What number comes next in the sequence?” The user has to type their answer. The program should check if they have got the right answer or not.