Recursive Sequence Calculator
Enter the coefficients, seed values, and term count to generate the sequence.
Result
How it is calculated
You supply two starting values and three constants, and the tool builds each new term from the two before it: a(n) = p × a(n−1) + q × a(n−2) + r. The first term listed is a0, the second is a1, the third is p × a1 + q × a0 + r, and so on. Number of terms N says how many terms to list, counting a0 as the first. N must be from 1 to 50; a fractional N is cut to its whole part, and N = 1 shows only a0. Coefficients and seeds may be negative or decimal. The tool returns no result if any term becomes non-finite or larger than about 9 × 1015 in size, because past that point digits would no longer be exact. The list always uses plain dot decimals with no thousands separators, so it can be copied; the last term is shown separately in the page's number format. With p = q = 1, r = 0 and seeds 0 and 1 you get the Fibonacci numbers.
Worked example
Take p = 2, q = 1, r = 0 with a0 = 0 and a1 = 1, the Pell recurrence a(n) = 2·a(n−1) + a(n−2), and ask for 8 terms. The first two are 0 and 1. Then 2×1 + 0 = 2, 2×2 + 1 = 5, 2×5 + 2 = 12, 2×12 + 5 = 29, 2×29 + 12 = 70, 2×70 + 29 = 169. The tool lists 0, 1, 2, 5, 12, 29, 70, 169, and the last term is 169. Each term is slightly more than twice the one before it.
Common mistakes
- Expecting the count to start from a1 or to leave out a0. The list always starts with a0, so 8 terms ends at the term built from index 7.
- Treating the constant r as a multiplier. It is added once at every step, not multiplied by an earlier term.
- Swapping the coefficients. p multiplies the term just before, q the one before that; swapping them gives a different sequence.
- Asking for more than 50 terms, or for 0 terms. Both give no result.
- Picking coefficients that grow so fast that a term passes about 9 × 1015, for example p = q = 2 over many terms. The tool then shows nothing rather than inexact digits; ask for fewer terms.
About this calculator
A second-order linear recurrence defines each term from the two before it: a(n) = p·a(n-1) + q·a(n-2) + r. Set p=q=1, r=0 and seed with 0,1 and you get the Fibonacci sequence; different coefficients generate Lucas numbers, Pell numbers, and countless other classic sequences.
Recurrences like this appear throughout computer science and mathematics — analyzing the running time of recursive algorithms, modeling population growth, and describing digital filters in signal processing — because many real processes depend on their two most recent states rather than an explicit formula for the n-th term.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Changing only the seeds gives a different family with the same rule. With p and q equal to 1 and seeds 2 and 1, the list starts 2, 1, 3, 4, 7, 11, 18, 29, which is the Lucas sequence rather than Fibonacci. This makes the tool handy for checking a hand-written recurrence from a homework problem or a loop you coded: compare the first ten terms before trusting the rest. Which recurrences would you like to see offered as presets?