FindSequenceFunction[{a1,a2,a3,…}]
attempts to find a simple function that yields the sequence an when given successive integer arguments.
FindSequenceFunction[{{n1,a1},{n2,a2},…}]
attempts to find a simple function that yields ai when given argument ni.
FindSequenceFunction[n1a1,n2a2,…]
gives a function that yields ai when given argument ni.
FindSequenceFunction[{n1a1,n2a2,…}]
gives a function that yields ai when given argument ni.
FindSequenceFunction[list,n]
gives the function applied to n.
FindSequenceFunction
FindSequenceFunction[{a1,a2,a3,…}]
attempts to find a simple function that yields the sequence an when given successive integer arguments.
FindSequenceFunction[{{n1,a1},{n2,a2},…}]
attempts to find a simple function that yields ai when given argument ni.
FindSequenceFunction[n1a1,n2a2,…]
gives a function that yields ai when given argument ni.
FindSequenceFunction[{n1a1,n2a2,…}]
gives a function that yields ai when given argument ni.
FindSequenceFunction[list,n]
gives the function applied to n.
Details and Options
- The sequence elements an can be either exact numbers or symbolic expressions.
- FindSequenceFunction finds results in terms of a wide range of integer functions, as well as implicit solutions to difference equations represented by DifferenceRoot.
- If FindSequenceFunction cannot find a simple function that yields the specified sequence, it returns unevaluated.
- The following options can be used:
-
FunctionSpace Automatic where to look for candidate simple functions Method Automatic method to use TimeConstraint 10 how many seconds to search a particular function space or perform a transformation ValidationLength Automatic sequence length used to validate a candidate function found - FindSequenceFunction[list] by default uses earlier elements in list to find candidate simple functions, then validates the functions by looking at later elements.
- FindSequenceFunction[list] only returns functions that correctly reproduce all elements of list.
Examples
open all close allBasic Examples (2)
Find a function that yields the sequence 1, 1, 2, 3, 5, 8, 13, …:
FindSequenceFunction[{1, 1, 2, 3, 5, 8, 13}, n]Table[Fibonacci[n], {n, 7}]Find a function that yields the given sequence as a subsequence:
Table[{2n, 2 ^ n}, {n, 8}]FindSequenceFunction[Table[{2n, 2 ^ n}, {n, 10}], n]Table[{n, %}, {n, 2, 16, 2}]Scope (5)
FindSequenceFunction[{-1, 1, -1, 1, -1, 1}, n]FindSequenceFunction[{2, 5, 10, 17, 26, 37, 50}, n]FindSequenceFunction[{2, 5 / 2, 10 / 3, 17 / 4, 26 / 5, 37 / 6, 50 / 7}, n]FindSequenceFunction[{1, 2, 6, 24, 120, 720, 5040}, n]FindSequenceFunction[{2, 3 / 2, 7 / 3, 13 / 4, 26 / 5, 49 / 6, 92 / 7, 169 / 8, 307 / 9, 551 / 10, 980 / 11, 1729 / 12, 3030 / 13, 5279 / 14,
9151 / 15, 15793 / 16, 27150 / 17, 46513 / 18}, n]Generalizations & Extensions (1)
FindSequenceFunction works on arbitrary exact numbers or symbolic expressions:
FindSequenceFunction[{1 + E, Sqrt[2] + E, 2 + E, 2Sqrt[2] + E, 4 + E}, n]//FullSimplifyFindSequenceFunction[{1 + a, 1 + a ^ 2, 1 + a ^ 3, 1 + a ^ 4, 1 + a ^ 5}, n]Applications (6)
Find formulas for complex sequences:
Table[Det[HilbertMatrix[n]], {n, 10}]f = FindSequenceFunction[%, n]Use additional values to validate the result:
Table[Det[HilbertMatrix[n]], {n, 10, 50}] - Table[f, {n, 10, 50}]Find a closed form for a sequence of definite integrals:
Table[Integrate[x ^ n(1 - 2x) ^ n, {x, 0, 1}], {n, 10}]FindSequenceFunction[%, n]Find a closed form for the number of 0,1 sequences of length
containing two adjacent 1s:
Table[Count[Tuples[{1, 0}, n], {___, 1, 1, ___}], {n, 10}]FindSequenceFunction[%, n]//FullSimplifyGenerate a sequence from a power series expansion:
CoefficientList[Series[Exp[x ^ 2], {x, 0, 20}], x]s1 = FindSequenceFunction[%, n]Use SeriesCoefficient to find an alternative formula:
s2 = SeriesCoefficient[Exp[x ^ 2], {x, 0, n}]FindSequenceFunction assumes that sequences start with index 1:
s1 = s1 /. n -> n + 1Table[s1 - s2, {n, 0, 20}]Compute a finite number of Fourier coefficients:
Table[FourierCoefficient[SquareWave[x / (2Pi)], x, n], {n, 1, 10}]FindSequenceFunction[%, n]Use a FourierCoefficient directly:
FourierCoefficient[SquareWave[x / (2Pi)], x, n]Verify the consistency of formulas:
Simplify[%% - %, n∈Integers && n > 0]Construct the Cantor set by starting with a {0,1} interval and removing the middle third of each interval in each step:
cantor = {a_, b_} :> {{a, a + (b - a) / 3}, {a + (b - a)2 / 3, b}};CantorRegion[n_Integer ? NonNegative] :=
Interval@@Nest[Flatten[Map[Function[s, s /. cantor], #], 1]&, {{0, 1}}, n]CantorRegion[1]CantorRegion[2]NumberLinePlot[Table[CantorRegion[i], {i, 3}], PlotRange -> {{0, 1}, Automatic}]Find the length of the region:
Table[RegionMeasure[CantorRegion[i]], {i, 5}]Find a formula for the sequence of lengths using FindSequenceFunction:
FindSequenceFunction[%, n]Properties & Relations (2)
Sum, Product, and other general discrete functions may be used:
FindSequenceFunction[{1, 2, 3, 5, 17, 305, 34865, 24918065, 125436246065, 5056710181206065}, n]Find the generating function of a sequence:
FindSequenceFunction[{3, 7, 13, 21, 31, 43, 57}, n]GeneratingFunction[% /. n -> n + 1, n, x]FindGeneratingFunction[{3, 7, 13, 21, 31, 43, 57}, x]//TogetherRelated Links
Text
Wolfram Research (2008), FindSequenceFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/FindSequenceFunction.html (updated 2015).
CMS
Wolfram Language. 2008. "FindSequenceFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindSequenceFunction.html.
APA
Wolfram Language. (2008). FindSequenceFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindSequenceFunction.html
BibTeX
@misc{reference.wolfram_2026_findsequencefunction, author="Wolfram Research", title="{FindSequenceFunction}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FindSequenceFunction.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_findsequencefunction, organization={Wolfram Research}, title={FindSequenceFunction}, year={2015}, url={https://reference.wolfram.com/language/ref/FindSequenceFunction.html}, note=[Accessed: 13-June-2026]}