Calculate a Recurrence Sequence
Enter coefficients in order from the most recent previous term to the oldest previous term. Separate numbers with commas or spaces.
Try an example
What Is a Recurrence Relation?
A recurrence relation defines a sequence by specifying how to calculate a new term from one or more earlier terms. Initial conditions supply the starting values needed to begin the calculation.
General linear recurrence
Here:
- an is the term being calculated.
- c1, ..., ck are the recurrence coefficients.
- k is the order of the recurrence.
- Initial conditions provide the first k values.
Example: Fibonacci recurrence
With initial conditions a0 = 0 and a1 = 1:
Each new term is the sum of the two terms immediately before it. This calculator can generate Fibonacci numbers, Lucas numbers, and many other linear recurrence sequences using custom coefficients.
How to use the calculator
- Enter the recurrence coefficients from newest previous term to oldest.
- Enter the same number of initial values as coefficients.
- Choose how many total terms you want, including the initial values.
- Select Calculate Sequence to see the generated terms and calculations.
More examples
| Sequence | Coefficients | Initial conditions | First terms |
|---|---|---|---|
| Fibonacci | 1, 1 | 0, 1 | 0, 1, 1, 2, 3, 5, ... |
| Lucas | 1, 1 | 2, 1 | 2, 1, 3, 4, 7, 11, ... |
| Custom second order | 2, 3 | 1, 2 | 1, 2, 7, 20, 61, ... |
| Alternating signs | -1 | 1 | 1, -1, 1, -1, 1, ... |
| Third order | 1, 1, 1 | 0, 0, 1 | 0, 0, 1, 1, 2, 4, ... |
Frequently Asked Questions
What is the order of a recurrence relation?
The order is the number of previous terms used to calculate the next term. A second-order recurrence uses two previous terms and requires two initial values.
Can I use negative coefficients?
Yes. Negative and zero coefficients are supported, as are decimal coefficients and initial values.
Can I calculate Fibonacci or Lucas numbers?
Yes. Use coefficients 1, 1. For Fibonacci numbers, enter initial conditions 0, 1. For Lucas numbers, enter 2, 1.
Are the results exact?
The calculator uses floating-point arithmetic. Many small integer sequences will display as expected, but very large terms and some decimal calculations can be approximate.
How many terms can I generate?
You can request up to 500 terms per calculation. Extremely fast-growing sequences may exceed the supported numeric range before reaching that limit.