# Number Sequences

#### Learning Objectives

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: #### Number Sequences

There are different types of number sequences. Let’s investigate the most widely used types of number sequences.

##### Arithmetic Sequences

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”) ##### Geometric Sequences

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”) ##### Square Numbers

1,4,9,16,25,36…

This sequence consists of calculating the squares of whole numbers. ##### Incremental Sequence

1, 2, 4, 7, 11, 16, 22, 29, 37, …

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. ##### Fibonacci Numbers

1, 2, 3, 5, 8, 13, 21, 34, …

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) #### Challenge #1

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!

#### Challenge #2

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.