Skip to content

Number Sequence Solver

Type a list of numbers and the solver looks for a rule that generates it — arithmetic, geometric, polynomial (using a difference table) or a Fibonacci-style recurrence. You get the n-th term formula, the next terms you ask for, and the working. It uses exact fractions, and it says plainly when it finds nothing. Free, no sign-up — it runs entirely in your browser.

Numbers, decimals or fractions (1/2) separated by commas or spaces. Use semicolons between terms if you write decimals with a comma. 3 to 24 terms.

1 to 20.

Results

Polynomial of degree 2

Rule found

42

Next term

5

Terms entered

The differences at level 2 are all equal, so the terms follow a polynomial of degree 2 in n.

The rule

n-th term: aₙ = n² + n

Next terms

a6 = 42

a7 = 56

a8 = 72

a9 = 90

a10 = 110

Difference table

Subtract each term from the next to get the first differences, then repeat. When a row is constant the terms follow a polynomial of that degree.

Levela₁a₂a₃a₄a₅
Terms26122030
Differences, level 146810
Differences, level 2 (constant)222
Differences, level 300
Differences, level 40

This tool finds a rule that fits, not the rule. Any list is consistent with infinitely many rules; it reports the simplest kinds, and only those confirmed by a spare term.

How to Use the Number Sequence Solver

  1. 1. Enter the terms. Separate numbers with commas or spaces. Decimals and fractions such as 1/2 are fine and stay exact. If you write decimals with a comma, separate the terms with semicolons instead.
  2. 2. Choose how many next terms. Anything from 1 to 20.
  3. 3. Read the rule. The headline gives the kind of rule, then the n-th term formula and a recurrence where there is a natural one. Terms are numbered from n = 1.
  4. 4. Check the working. The difference table shows each row of differences; a row that stops changing is what reveals a polynomial rule.

How the Solver Looks for a Rule

RuleHow it is recognisedTerms needed
ArithmeticThe first differences are all equal.3
GeometricThe ratios of consecutive terms are all equal (and no term is 0).3
Quadratic, cubic, … (polynomial)The second, third, … differences are all equal.4 for a quadratic, 5 for a cubic
Recurrence with a constantEach term is r times the last, plus c, as in 1, 3, 7, 15, 31.4
Fibonacci-styleEach term is p times the last plus q times the one before.5

The last column is the important one. A rule with k unknowns can always be made to fit k terms, so the solver demands one spare term: it fits the rule to the first terms and then checks that it predicts the rest. Three numbers cannot confirm a quadratic, because a quadratic can be drawn through any three points.

Worked Example: Difference Tables

Take 2, 6, 12, 20, 30. Subtract neighbouring terms to get 4, 6, 8, 10; subtract again to get 2, 2, 2. The second differences are constant, so the rule is a quadratic.

Difference table for 2, 6, 12, 20, 30

Terms:               2    6   12   20   30
1st differences:       4    6    8   10
2nd differences:         2    2    2

To turn the first entry of each row into a formula, use Newton's forward-difference form: aₙ = a₁ + Δ₁·(n − 1) + Δ₂·(n − 1)(n − 2) ÷ 2, where Δ₁ = 4 and Δ₂ = 2. That gives 2 + 4(n − 1) + (n − 1)(n − 2) = n² + n. The next terms are 6 × 7 = 42, 56 and 72. The same method gives 5, 6, 8, 11, 15, 20 → aₙ = (1/2)n² − (1/2)n + 5, and the next term is 26.

The other families are quicker. 3, 7, 11, 15 has a constant difference of 4, so aₙ = 4n − 1 and the next term is 19. 2, 6, 18, 54 has a constant ratio of 3, so aₙ = 2 · 3n − 1 and the next term is 162. 1, 3, 7, 15, 31 has neither, but each term is double the last plus 1, which gives aₙ = 2ⁿ − 1 and the next term 63. 1, 1, 2, 3, 5, 8 is the Fibonacci rule, and the next term is 13.

A Rule, Not the Rule

Every finite list fits infinitely many rules

Given 1, 2, 4, 8, 16 the solver answers 32 (doubling). But the number of regions a circle is cut into by chords joining n points is 1, 2, 4, 8, 16, 31 — the same first five terms, a different sixth. Likewise 1, 2, 3, 4, 5 continues 6 under the arithmetic rule, yet a degree-5 polynomial passes through those five points and also through 120. The solver reports the simplest rules that survive a check, which is usually what a puzzle intends, but it cannot prove it is what you intend.

Frequently Asked Questions

What is the next number in the sequence 2, 6, 12, 20, 30?
42. The first differences are 4, 6, 8, 10 and the second differences are all 2, so the n-th term is n² + n = n(n + 1). The next terms are 42, 56, 72 and 90.
How do you find the n-th term of a quadratic sequence?
Build the difference table. If the second differences are constant, write the n-th term as an² + bn + c with a equal to half the second difference. Subtract an² from each term to get a linear sequence, whose rule gives bn + c. Or enter the terms above and read the formula.
How can I tell if a sequence is arithmetic or geometric?
Subtract neighbouring terms: if the answers are all equal, it is arithmetic. Divide neighbouring terms: if the answers are all equal, it is geometric. In 4, 7, 10, 13 the differences are all 3; in 4, 12, 36, 108 the ratios are all 3.
What does it mean if the differences never become constant?
Either the sequence is not a polynomial, or you have not entered enough terms to see the constant row. Exponential sequences like 1, 2, 4, 8 have differences that repeat the sequence, so you should check for a common ratio instead, or a recurrence such as 'double and add 1'.
Why does the solver need four terms for a quadratic?
A quadratic has three unknown coefficients, so three terms fix it exactly — and then nothing is left to test. With a fourth term the rule has to predict something it was not fitted to. That spare term is what separates a rule from a coincidence.
Can a sequence have more than one correct answer?
Yes. Without more information any continuation is possible, and puzzle setters rely on the reader choosing the simplest rule. If your answer key disagrees with the solver, compare rules, not just numbers — the key may be using a different one.
Does it work with fractions and negative numbers?
Yes. Terms such as 1/2, 3/4, 1 and −2.5 are read exactly and all the arithmetic is done with fractions, so 1/3, 2/3, 1 is arithmetic with a difference of 1/3 rather than a rounded 0.3333.

Related Tools

More in Math Calculators

See all Math Calculators