# Sequence Calculator

Created by Davide Borchia
Reviewed by Anna Szczepanek, PhD and Adena Benn
Last updated: May 10, 2023

Learn how to calculate sequences of numbers or simply find the values of their term with our versatile tool! Keep reading this article to learn:

• What numerical and integer sequences are;
• The formulas to calculate a sequence's nth term (arithmetic and geometric sequences);
• Interesting integer sequences (prime numbers, Fibonacci numbers, figurate numbers);
• And much more.

We will teach you how to use our versatile tool and give you some examples of sequence calculations. What are you waiting for? Let's start counting!

## What is a numerical sequence? What are integer sequences?

A numerical sequence is an ordered (enumerated) list of numbers where:

• The order in which the numbers appear matters;
• Repetition is allowed; and
• Each term can be considered the output of a function where instead of an argument, we specify a position.

The terms of a sequence are (usually) represented by the letter $a$ followed by the position (or index) as subscript. Then, the first term of a sequence would be $a_0$, followed by $a_1$. A generic term in position $n$ is $a_{(n+1)}$.

Among many types of sequences, it's worth remembering the arithmetic and the geometric sequences.

#### Integer sequences

If each term of a sequence is an integer number, then we are dealing with integer sequences. While technically, there's not much difference from any other generic mathematical sequence; we can quickly calculate integer sequences by hand. Many integer sequences are well known. We can quote:

• The Fibonacci sequence;
• The prime numbers sequence;
• The square and cube numbers; and
• Many more.

## How to calculate the arithmetic sequence: formula and definition

The arithmetic sequence is, arguably, the most common and straightforward of the mathematical sequences. An arithmetic sequence is a sequence where two adjacent terms differ by the same constant difference. In mathematical terms, we write this definition as:

$a_{n+1} = a_n + d$

where $d$ is the constant difference.

You can calculate a sequence defined this way by only knowing an initial value and $d$: repeated subtractions and sums will eventually populate all possible positions.

For this reason, we can easily find the first term of the sequence ($a_0$) if we know the value at position $n$ and $d$, or the n-th terms starting from the first one and $d$. We use this formula, changing the position of the factors according to what we are looking for:

$a_0 = a_n - n\cdot d$

If you plot the terms of an arithmetic sequence, you'll find a straight line that, in the Cartesian coordinates, would have a slope equal to $d$.

🙋 Head to our arithmetic sequence calculator for a complete analysis of this versatile numerical sequence!

## Calculate the geometric sequence: formula and properties

In a geometric sequence, two adjacent terms have constant ratio $r$. This ratio is given by the formula:

$r = \frac{a_n}{a_{n-1}}$

Using this formula, we calculate the terms of a geometric sequence by simply multiplying (if we are moving forward) or dividing (if you are moving in the opposite direction) a term by $r$:

$a_n = r\cdot a_{n-1}$

To calculate the nth term of a geometric sequence starting from the initial term $a_0$, you can start by using the previous formula to calculate the sequences' first terms:

$\begin{split} a_1&= r\cdot a_0\\ a_2& = r\cdot a_1=r\cdot r\cdot a_0 \\ a_3&=r\cdot a_2= r\cdot r\cdot r\cdot a_0 \end{split}$

As you can see, the constant ratio can be expressed as a power: $r^2$, $r^3$, and so on. So to calculate the nth term of a geometric sequence, we raise $r$ to the proper exponent:

$a_n = r^n \cdot a_0$

A geometric sequence can grow extremely fast for constant ratios greater than $1$, closely resembling the behavior of exponential growth.

## Other type of "geometric" sequences: square, cubes, and triangles

Number theory and geometry meet in an unexpected way involving the so-called figurate numbers. A figurate number of items can be arranged in a specific geometric shape: a square number of dots, for example, can be arranged in a square. Take $36$, for example:

As you can see, we can arrange $36$ as a square with side $6$. Square numbers are the most famous figurate number, closely followed by cube numbers. Their sequences are pretty straightforward.

For square numbers, the nth term is:

$a_n = n^2$

Similarly, for cube numbers, we have:

$a_n = n^3$

The first ten square numbers, starting from $a_0=0$ are:

$\begin{split} a_0 &=0 \\a_ 1&=1 \\a_ 2&=4 \\a_ 3&= 9\\a_ 4&=16 \\a_5 &=25 \\a_6 &=36 \\a_7 &=49 \\a_ 8&=64 \\a_9 &=81 \\ \end{split}$

The first ten cube numbers are:

$\begin{split} a_0 &=0 \\a_ 1&=1 \\a_ 2&=8 \\a_ 3&= 27\\a_ 4&=86 \\a_5 &=125 \\a_6 &=216 \\a_7 &=343 \\a_ 8&=512 \\a_9 &=729 \\ \end{split}$

Notice how quickly the last set grows compared to the former!

Triangular numbers are slightly less common, as they find fewer applications and remain mostly a niche mathematical curiosity. However, we think they are pretty cool, so we included them in our calculator!

The nth term of the sequence of triangular numbers is given by the following formula:

$T_n = \frac{n\cdot(n+1)}{2} = \binom{n+1}{2}$

where the second equality introduces the concept of binomial coefficient.

The first set of triangular numbers are:

$\begin{split} T_0 &=0 \\T_ 1&=1 \\T_ 2&=3 \\T_ 3&= 6\\T_ 4&=10 \end{split}$

Maybe it's not evident, but there is a neat relationship between square numbers and triangular numbers. If you consider the same initial term $a_0=T_0=0$, then:

$a_n = T_{n-1}+T_n$

You can see this formula with your eyes:

🙋 We made a complete tool dedicated to these numbers: visit the triangular numbers calculator!

## Prime number sequence and Fibonacci sequence

There are two additional sequences of particular interest in number theory due to their properties and repeated appearances in mathematics. We are talking about prime numbers and Fibonacci numbers.

Prime numbers are numbers divisible only by themselves and by $1$. We can use the ancient Erathostenes's sieve algorithm, but this method is not useful for large terms. Nowadays, it's easy to find tabulated sequences of prime numbers, such as this . Here is a sequence of the first prime numbers

$2,3,5,7,11,13,17,19,23,29,...$

$1$ and $0$ are not prime numbers, even though the former was a matter of a long debate!

Fibonacci numbers can be considered a twisted form of an arithmetic sequence, where the constant difference is not constant: instead, the difference between two adjacent numbers in the Fibonacci sequence is equal to the term right before both of them. In mathematical terms, we write:

$a_{n} - a_{n-1} =a_{n-2}$

which allows us to write the expression for the n-th term:

$a_{n} = a_{n-1} +a_{n-2}$

There is no way to escape this constraint: even to start the sequence, we need to specify two Fibonacci numbers. By convention:

$\begin{split} F_0&=0\\ F_1&=1 \end{split}$

Knowing the first two terms, we can compute the third one:

$a_2 = a_0+a_1 = 0+1 = 1$

Yup, repetition is allowed. And while in other instances, this would cause the sequence to repeat itself, after the third term, the numbers of the Fibonacci sequence never repeat. The next terms would be:

$\begin{split} a_3 &= 1+1=2\\ a_4 &= 2+1=3\\ a_5&=3+2=5\\ a_6&=5+3=8\\ a_7&=8+5=13 \end{split}$

## How to calculate the nth term of a sequence of powers of 2, factorial, and stars numbers

#### Powers of 2

We included another significant sequence in our calculator: the sequence of the powers of 2. This sequence is nothing but a geometric sequence with constant ratio $r=2$ starting at $a_0=2^0=1$.

Even though it's "just" a geometric sequence, with the development of informatics, the powers of two became a staple of our civilization; hence they deserve this appearance!

#### Factorials

Factorial numbers are interesting numbers where, if we set $a_1=1$, then $a_n$ is equal to the product of all integers between $1$ and $n$. In mathematical terms:

$a_n = 1\cdot2\cdot3\cdot...\cdot(n-1)\cdot n$

The first factorial numbers are:

$\begin{split} a_1 &= 1=2\\ a_2 &= 1\cdot2=2\\ a_3&=1\cdot2\cdot3=6\\ a_4&=1\cdot2\cdot3\cdot4=24\\ a_5&=1\cdot2\cdot3\cdot5=120 \end{split}$

Factorial numbers grow pretty quickly! In mathematics, they have an important role in combinatorics, the study of the ways we can arrange objects belonging to a set.

🙋 Factorial numbers are identified by an exclamation mark: $5! = 120$. The number of jokes about this in mathematics is too high, at least 12! ($=479001600$).

#### Star numbers

The last sequence you will explore in our number sequence calculator is the star numbers, another class of figurate numbers where each term indicates the size of a collection of items you can arrange in a six-pointed star fashion. There is a neat formula to calculate the nth term of this sequence:

$s_n = 6\cdot n \cdot (n-1) + 1$

The first star numbers are $1,\ 13,\ 37,...$. Here is a graphical representation of $s_2=37$ ## How to use our sequence calculator

Our sequence calculator is a versatile tool. To use it, follow these simple steps:

1. Choose the type of sequence you are interested in: use the drop-down menu at type.

2. Fill the parameters of the desired sequence. What can we ask you?

• We always ask you the initial position: this is the index of the first term of which you want to see the value. If you input $5$, we will print the terms starting from $a_5$.

• The first term of the sequence. This can help us find the terms starting at the selected position in the geometric and arithmetic sequence.

• The constant ratio or constant difference if they appear in the sequence's formula.

3. Once you fill in all the required, we will print the first five terms starting from the selected index.

🙋 Our calculators also work in reverse: if you input a correct number in one of the five positions, there's a chance we can calculate the other members and parameters. Explore this functionality!

Don't mistake sequence and series: discover their difference in the sum of series calculator.

## FAQ

### What is the formula to calculate the arithmetic sequence?

The formula to calculate the arithmetic sequence is:

an = a0 + n × d

where:

• a0 — The first term of the series;
• d — The constant difference between two adjacent terms; and
• n — The position of the nth term.

You can easily derive this formula from the definition of arithmetic sequence:

an = an-1 + d

where you can substitute an-1 recursively:

an = an-2 + d + d

until you reach the initial term a0.