# Linear recurrence calculator

## World's simplest number tool

Quickly generate a linear recurrence sequence in your browser. To get your sequence, just specify the initial values, coefficients and the length of the sequence in the options below, and this utility will generate that many linear recurrence series numbers. Created by developers from team Browserling.

a new math project!
announcement

Love math as much as we do? Then you'll also love our new project – MATHURLS – a super neat math news aggregator. Check it out!

*fullscreen*

*fullscreen_exit*

A link to this tool, including input, options and all chained tools.

Can't convert.

Linear recurrence calculator tool
What is a linear recurrence calculator?

This is an online browser-based utility for generating linear recurrence series. A linear recurrence is a recursive relation of the form xₙ = Axₙ₋₁ + Bxₙ₋₂ + Cxₙ₋₃ + Dxₙ₋₄ + Exₙ₋₅ + …. Constants A, B, C, D, E are real numbers, and xₙ is expressed in terms of the previous n elements of the series. That is, each term of the sequence is a linear function of earlier terms in the sequence. For example, the Fibonacci sequence is a linear recurrence series. It is given by the linear equation xₙ = Axₙ₋₁ + Bxₙ₋₂, where A = B = 1 (all other coefficients C = D = E = 0), with initial values x₁ = 0 and x₂ = 1. Substituting the initial values into the recurrent formula, you can find the series that forms the Fibonacci numbers. Other examples of linear recurrence equations are the Lucas numbers, Pell numbers, and Padovan numbers. In this tool, you can generate a linear recurrence with up to five terms in the sum. To specify the recurrence relation, you only need to adjust the coefficients A, B, C, D, E. If any coefficient is not specified, then this term is not used in the recurrence formula. To specify the starting values, you need to fill in the xₙ fields. You can also specify how many terms of recurrence equation you need and what symbol you want to separate them with. That's numberwang!

Linear recurrence calculator examples
Click to use

Fibonacci Relation

In this example, we generate a second-order linear recurrence relation. We set A = 1, B = 1, and specify initial values equal to 0 and 1. From these conditions, we can write the following relation xₙ = xₙ₋₁ + xₙ₋₂. This relation is a well-known formula for finding the numbers of the Fibonacci series.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Lucas Numbers

In this example, we're using the same linear recurrence as in the previous example because A = B = 1. However, here the first initial value is 2 and the second is 1. So, we get the recursion xₙ = xₙ₋₁ + xₙ₋₂, with x₁ = 2, x₂ = 1. These conditions correspond to the recurrence formula that calculates the Lucas number sequence.

2
1
3
4
7
11
18
29
47
76

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Padovan Sequence

In this example, we calculate a third-order linear recurrence equation. It has the following coefficients: A = 0, B = 1, C = 1, and initial values: x₁ = 1, x₂ = 1, x₃ = 1. So, we get the linear equation xₙ = xₙ₋₂ + xₙ₋₃, which forms the Padovan sequence. We calculate the following numbers up to x₂₀ term and separate them with a semicolon character.

1; 1; 1; 2; 2; 3; 4; 5; 7; 9; 12; 16; 21; 28; 37; 49; 65; 86; 114; 151

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Pell Numbers

In this example, we generate Pell numbers. Pell numbers are calculated by the following recurrence: xₙ = 2xₙ₋₁ + xₙ₋₂, where x₁ = 0, x₂ = 1. That is, a doubled previous term plus another previous term forms the next term. For example, 2*1 + 0 = 2, 2*2 + 1 = 5, 2*5 + 2 = 12, and so on. We generate twelve Pell numbers, and place "=>" symbol between them.

0 => 1 => 2 => 5 => 12 => 29 => 70 => 169 => 408 => 985 => 2378 => 5741

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Pell-Lucas Series

In this example, we calculate the Pell-Lucas series (also known as companion Pell series). Pell-Lucas numbers are calculated according to the same recurrence formula as in the previous example, but here both initial values are equal to 2. As the initial values are even, and the equation is linear and has no odd terms, the Pell-Lucas numbers are always even.

2 2 6 14 34 82 198 478 1154 2786 6726 16238 39202 94642 228486

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Perrin Numbers

In this example, we generate Perrin numbers. The linear relation for the Perrin series is the same as for the Padovan series (see example above) but with different initial conditions – x₁ = 3, x₂ = 0, x₃ = 2. We calculate forty Perrin numbers and separate them by the "~" character.

3 ~ 0 ~ 2 ~ 3 ~ 2 ~ 5 ~ 5 ~ 7 ~ 10 ~ 12 ~ 17 ~ 22 ~ 29 ~ 39 ~ 51 ~ 68 ~ 90 ~ 119 ~ 158 ~ 209 ~ 277 ~ 367 ~ 486 ~ 644 ~ 853 ~ 1130 ~ 1497 ~ 1983 ~ 2627 ~ 3480 ~ 4610 ~ 6107 ~ 8090 ~ 10717 ~ 14197 ~ 18807 ~ 24914 ~ 33004 ~ 43721 ~ 57918

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Negafibonacci Numbers

In this example, we set one coefficient to a negative value and get the following recurrence formula xₙ = xₙ₋₂ - xₙ₋₁. This means that the next series member is calculated as the difference between the two previous ones. We use the initial values 0 and 1 for the first two terms, and here's how we calculate some of following terms: 0 - 1 = -1, 1 - (-1) = 2, -1 - 2 = -3, and so on. As you can see, these numbers are members of the Negafibonacci sequence. We find 15 elements and separate them with a comma character.

0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55, 89, -144, 233, -377

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Periodic Series

In this example, the recurrence relation is very similar to the previous example, but here we set the coefficient B = -1, and the first two values both to 1. Let's try to calculate a few subsequent values. F₃ = 1 - 1 = 0, F₄ = 0 - 1 = -1, F₅ = -1 - 0 = -1, F₆ = -1 - (-1) = 0, F₇ = 0 - (-1) = 1, F₈ = 1 - 0 = 1. As you can see in terms 7 and 8, we have returned to our initial values. What that means is that the sequence will periodically repeat and we get a cycle.

1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1; 0; -1; -1; 0; 1; 1

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Fifth-order Linear Relation

In this example, we use a linear equation with five members. The number of members in the equation determines the order of the series. In this case, it's the fifth order series. From the given coefficients we get the following relation xₙ = xₙ₋₁ - xₙ₋₂ + xₙ₋₃ - xₙ₋₄ + xₙ₋₅, with initial values x₁ = x₃ = x₅ = 0.5, and x₂ = x₄ = 1. We've selected the initial conditions so that the series is periodic. That is, after every 6 terms the result repeats again. We generate 100 numbers here and separate them with a space.

0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1 0.5 -0.5 0.5 1 0.5 1

**Required options**

Coefficient A.

Number x

_{n-1}.
Coefficient B.

Number x

_{n-2}.
Coefficient C.

Number x

_{n-3}.
Coefficient D.

Number x

_{n-4}.
Coefficient E.

Number x

_{n-5}.
How many x

_{n}numbers to calculate?
Which symbol to delimit
the output terms with?
(By default the new-line \n.)

Pro tips
Master online number tools

You can pass options to this tool using their codes as query arguments and it will automatically compute output. To get the code of an option, just hover over its icon. Here's how to type it in your browser's address bar. Click to try!

https://onlinenumbertools.com/linear-recurrence-calculator?&A=1&B=1&C=&D=&E=&xn-1=0&xn-2=1&xn-3=&xn-4=&xn-5=&count=25&separator=%2C%20

All number tools

Quickly create a list of numbers in arithmetic series.

Quickly create a list of numbers in geometric series.

Quickly calculate the coefficients of the binomial expansion.

Quickly create a downloadable image from numbers.

Quickly create a list of random numbers.

Quickly create a list of random primes from a specific interval.

Quickly create a matrix with random numbers as its elements.

Quickly create a random row or column vector.

Quickly exchange rows and columns of a matrix.

Quickly find the inverse matrix of any square matrix.

Quickly find the determinant of any square matrix.

Quickly calculate any number of digits of number π.

Quickly generate the specified number of Euler constant's digits.

Quickly generate any number of golden ratio digits.

Quickly generate numbers of say what you see sequence.

Quickly calculate numbers of Fibonacci sequence.

Quickly calculate numbers of Lucas series.

Quickly generate Fibonacci-like series with custom start values.

Quickly calculate members of a linear recurrence series.

Quickly create a sequence of prime numbers.

Quickly check if the given number is a prime.

Quickly compute all prime factors of a number.

Quickly compute all divisors of a number.

Quickly calculate the GCD of two or more numbers.

Quickly calculate the LCM of two or more numbers.

Quickly create a list of increasing or decreasing integers.

Quickly create a sequence of even numbers.

Quickly create a sequence of odd numbers.

Quickly create a list of squares.

Quickly create a list of cubes.

Quickly generate a series of numbers in the form 2^n.

Quickly generate a series of numbers in the form 10^n.

Quickly choose one or more numbers from a list of numbers.

Quickly round one or more numbers to the given accuracy.

Quickly sort numbers in ascending or descending order.

Quickly sort number's digits in ascending or descending order.

Quickly randomize the order of digits in a number.

Quickly filter numbers according to certain criteria.

Quickly add up all the numbers in the given list and find their sum.

Quickly multiply all the numbers together and find their product.

Quickly add up all the digits of the given numbers.

Quickly multiply all the digits of the given numbers.

Quickly sum up all the fractions in the given list and find their total.

Quickly find the largest number in a number sequence.

Quickly find the smallest number in a number sequence.

Quickly create a diagonal matrix with ones on the main diagonal.

Quickly spell cardinal and ordinal numbers using English words.

Quickly convert spelled numbers to regular numbers.

Quickly convert a number to the form 2^x.

Quickly express a number in the form 10^x.

Quickly convert base 10 numbers to base -10.

Quickly convert a number from one base to any other base.

Quickly convert simple fractions to pretty Unicode fractions.

Quickly add digits to a number so that it becomes a palindrome.

Quickly test if the given numbers are palindromes.

Coming soon
These number tools are on the way

Generate Numberwang Numbers

Create a list of numberwang numbers.

Rewrite Numbers

Given numbers and a grammar, recursively rewrite them.

Create a Floating Point Number

Create a number from the mantissa, base and exponent.

Convert a Number to the Scientific Notation

Convert a number to the a*10^b form.

Convert Scientific Notation to a Number

Convert a number in scientific notation to a regular number.

Generate Random Binary Numbers

Create a list of random binary numbers.

Generate Random Octal Numbers

Create a list of random octal numbers.

Generate Random Decimal Numbers

Create a list of random decimal numbers.

Generate Random Hex Numbers

Create a list of random hexadecimal numbers.

Calculate a Running Sum

Calculate a cumulative sum of a list of numbers.

Calculate a Running Product

Calculate a cumulative product of a list of numbers.

Calculate the Factorial

Find the factorial of a number.

Generate Number Bigrams

Create a list of digit bigrams from a number.

Generate Number Trigrams

Create a list of digit trigrams from a number.

Generate Number N-grams

Create a list of digit ngrams from a number.

Generate a Polynomial Sequence

Create a list of polynomial progression numbers.

Generate SI Prefixes

Create a list of metric prefixes.

Analyze a Number

Report how many digits appear how many times.

Convert a Number to an Ordinal

Convert a cardinal number to an ordinal number.

Convert an Ordinal to a Number

Convert an ordinal number to a cardinal number.

Convert a Number to Roman Number

Convert Arabic numerals to Roman numerals.

Convert a Roman Number to Regular Number

Convert Roman Numerals to Arabic numerals.

Generate Negafibonacci Numbers

Calculate a series of extended Fibonacci numbers.

Generate Fibonacci Primes

Find numbers that are both Fibonacci numbers and primes.

Fibonacci Number Test

Check if a number is a Fibonacci number.

Fibonacci Prime Test

Check if a number is both a Fibonacci number and a prime.

Construct Fibonacci Words

Create a sequence of Fibonacci words.

Construct Tribonacci Words

Create a sequence of Tribonacci words.

Generate Negalucas Numbers

Calculate a series of extended Lucas numbers.

Generate Lucas Primes

Calculate a series of extended Lucas numbers.

Lucas Prime Test

Check if a number is both a Lucas number and a prime.

Calculate the Trace of a Matrix

Find the sum of main diagonal elements of a matrix.

Calculate the Eigenvalues of a Matrix

Find the eigenvalues of a matrix.

Multiply Matrices

Compute the product of two matrices.

Add Matrices

Compute the sum of two matrices.

Subtract Matrices

Compute the difference of two matrices.

Generate Moser de Bruijn Numbers

Calculate a sequence of Moser-Bruijn numbers.

Generate Kolakoski Numbers

Calculate a sequence of Oldenburger-Kolakoski numbers.

Generate Stanley Numbers

Calculate a sequence of Stanley numbers.

Generate Gijswijt Numbers

Calculate a sequence of self-describing Gijswijt numbers.

Generate Rudin-Shapiro Numbers

Calculate a sequence of Rusin-Shapiro numbers.

Generate Baum-Sweet Numbers

Calculate a sequence of Baum-Sweet numbers.

Generate Thue-Morse Sequence

Calculate members of Thue-Morse number series.

Generate Perfect Numbers

Create a list of perfect numbers.

Generate Almost Perfect Numbers

Create a list of almost perfect numbers.

Generate Excessive Number Sequence

Calculate a sequence of abundant numbers.

Generate Deficient Number Sequence

Calculate a sequence of deficient numbers.

Calculate Dragon Curve Numbers

Generate a list of paperfolding sequence numbers.

Generate Composite Numbers

Create a list of numbers that are not prime.

Draw a Numbers Table

Generate a table of numbers.

Test if a Number is Perfect

Check if the given number is a perfect number.

Test if a Number is Abundant

Check if the given number is an abundant number.

Test if a Number is Deficient

Check if the given number is a deficient number.

Calculate the Modulo

Find the modulus of a number.

Group Number Digits

Group together digits of a number.

Split a Number into Digits

Create a list of digits from a number.

Printf Numbers

Apply sprintf or printf function to numbers.

Create Zalgo Numbers

Let Zalgo destroy your numbers.

Mirror a Number

Create a mirror copy of a number.

Zero-pad a Number

Add zeros to a number.

Reverse a Number

Reverse the order of digits of a number.

Rotate a Number

Cyclically rotate digits of a number to the left or right.

Increase All Digits in a Number

Add one to every digit in a number.

Decrease All Digits in a Number

Subtract one from every digit in a number.

Count Number Occurrences

Find how often numeric values occur.

Calculate Percentages

Find x% of a number.

Generate Natural Numbers

Create a list of natural numbers.

Generate Rational Numbers

Create a list of rational numbers.

Generate Constant Sequence

Create a series of numbers where all terms are the same.

Generate Real Numbers

Create a sequence of real numbers.

Generate Complex Numbers

Create a list of complex numbers.

Generate Binary Numbers

Create a sequence of binary numbers.

Generate Pairs of Numbers

Create a sequence of number pairs.

Generate Triples of Numbers

Create a sequence of number triples.

Generate Tuples of Numbers

Create a sequence of number n-tuples.

Find the Decimal Expansion of a Number

Rewrite a number in the decimal representation.

Convert a Fraction to a Decimal

Convert a fraction to a decimal number.

Convert a Decimal to a Fraction

Convert a decimal number to a fraction.

Convert a Binary Number to Octal Number

Convert a base two number to base eight number.

Convert a Binary Number to Decimal Number

Convert a base two number to base ten number.

Convert a Binary Number to Hex Number

Convert a base two number to base sixteen number.

Convert a Octal Number to Binary Number

Convert a base eight number to base two number.

Convert a Octal Number to Decimal Number

Convert a base eight number to base ten number.

Convert a Octal Number to Hex Number

Convert a base eight number to base sixteen number.

Convert a Decimal Number to Binary Number

Convert a base ten number to base two number.

Convert a Decimal Number to Octal Number

Convert a base ten number to base eight number.

Convert a Decimal Number to Hex Number

Convert a base ten number to base sixteen number.

Convert a Hex Number to Binary Number

Convert a base sixteen number to base two number.

Convert a Hex Number to Octal Number

Convert a base sixteen number to base eight number.

Convert a Hex Number to Decimal Number

Convert a base sixteen number to base ten number.

Convert Any Number to Any Base

Convert any number in any base to any other base.

Change Number's Mantissa

Change the significand of a number.

Change Number's Exponent

Change the power of a number.

Numberwang Number Test

Test if the given number is numberwang.

Subscribe!
Never miss an update

Cool!

Notifications
We'll let you know when we add this tool

Cool!

_{n}= Ax_{n-1}+ Bx_{n-2}+ Cx_{n-3}+ Dx_{n-4}+ Ex_{n-5}