Skip to content

FindSequenceFunction ​

A closed form a(n)a(n) for a sequence given as a list a(0),a(1),…a(0), a(1), \dots, when one can be found.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageFindSequenceFunction!
FindSequenceFunction(list, n)a closed form for the sequence given by list, in n
Typed signatures
TypePackageApplies
(list<any>, symbol) -> anycombinatoricsalways

Domain: Combinatorics

Details
  • Tries, in order, a polynomial fit (exact finite differences: the least degree whose difference row vanishes), a small registry of named sequences (Fibonacci, Catalan, factorial, derangements, Bell numbers) matched by value, and a linear-recurrence fit (Berlekamp--Massey over ℚ) resolved to a closed form for orders 1 (geometric) and 2 (exponential-polynomial, via the recurrence's characteristic roots).
  • Every closed form found is exact -- re-evaluating it reproduces the input list precisely, not just approximately.
  • Falls back to staying symbolic when nothing fits.

Examples

Basic #

2n2^n

live ↗
InFindSequenceFunction([1,2,4,8,16],n)\mathrm{FindSequenceFunction}(\bigl\lbrack1, 2, 4, 8, 16\bigr\rbrack, n)Out2n2^{n}

(n+1)2(n+1)^2, found by finite differences

live ↗
InFindSequenceFunction([1,4,9,16,25],n)\mathrm{FindSequenceFunction}(\bigl\lbrack1, 4, 9, 16, 25\bigr\rbrack, n)Outn2+2n+1n^2+2n+1

recognised by value against the compute engine's own CatalanNumber

live ↗
InFindSequenceFunction([1,1,2,5,14,42,132],n)\mathrm{FindSequenceFunction}(\bigl\lbrack1, 1, 2, 5, 14, 42, 132\bigr\rbrack, n)OutCatalanNumber(n)\mathrm{CatalanNumber}(n)

n!n! -- not C-finite, so only reached via the named-sequence registry, not Berlekamp--Massey

live ↗
InFindSequenceFunction([1,1,2,6,24,120],n)\mathrm{FindSequenceFunction}(\bigl\lbrack1, 1, 2, 6, 24, 120\bigr\rbrack, n)Outn!n!
live ↗
InFindSequenceFunction([1,1,2,3,5,8,13],n)\mathrm{FindSequenceFunction}(\bigl\lbrack1, 1, 2, 3, 5, 8, 13\bigr\rbrack, n)Out110(5−5)(1−51/22)n+1105(1+5)(1+52)n\frac{1}{10}(5-\sqrt{5})(\frac{1-5^{1/2}}{2})^{n}+\frac{1}{10}\sqrt{5}(1+\sqrt{5})(\frac{1+\sqrt{5}}{2})^{n}
Scope #
live ↗
InFindSequenceFunction([−1,1,−1,1,−1,1],n)\mathrm{FindSequenceFunction}(\bigl\lbrack-1, 1, -1, 1, -1, 1\bigr\rbrack, n)Out−(−1)n-(-1)^{n}
live ↗
InFindSequenceFunction([2,5,10,17,26,37,50],n)\mathrm{FindSequenceFunction}(\bigl\lbrack2, 5, 10, 17, 26, 37, 50\bigr\rbrack, n)Outn2+2n+2n^2+2n+2
Properties #
live ↗
InFindSequenceFunction([3,7,13,21,31,43,57],n)\mathrm{FindSequenceFunction}(\bigl\lbrack3, 7, 13, 21, 31, 43, 57\bigr\rbrack, n)Outn2+3n+3n^2+3n+3
About
Examples8
Checked againstWolfram Language 8 differ
CrosswalkWolfram Language

See also: GeneratingFunction, ExponentialGeneratingFunction, DiscreteRatio