({{, (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[{(Subscript[a, 1]),(Subscript[a, 2]),(Subscript[a, 3]),…}] 
attempts to find a simple function that yields the sequence (Subscript[a, n]) when given successive integer arguments.}, {, (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[{{(Subscript[n, 1]),(Subscript[a, 1])},{(Subscript[n, 2]),(Subscript[a, 2])},…}]
attempts to find a simple function that yields (Subscript[a, i]) when given argument (Subscript[n, i]).}, {, (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[\[LeftAssociation](Subscript[n, 1])->(Subscript[a, 1]),(Subscript[n, 2])->(Subscript[a, 2]),…\[RightAssociation]]
gives a function that yields (Subscript[a, i]) when given argument (Subscript[n, i]).}, {, (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[{(Subscript[n, 1])->(Subscript[a, 1]),(Subscript[n, 2])->(Subscript[a, 2]),…}]
gives a function that yields (Subscript[a, i]) when given argument (Subscript[n, i]).}, {, (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[list,n]
gives the function applied to n.}})

OpenersNotesSection(Spacer1)Details and Options

The sequence elements (Subscript[a, n]) can be either exact numbers or symbolic expressions.

(RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]) finds results in terms of a wide range of integer functions, as well as implicit solutions to difference equations represented by (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]).

If (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]) cannot find a simple function that yields the specified sequence, it returns unevaluated.

The following options can be used:

(RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[list] by default uses earlier elements in list to find candidate simple functions, then validates the functions by looking at later elements.

(RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction])[list] only returns functions that correctly reproduce all elements of list.

OpenersPrimaryExamplesSection(Spacer1)Examples  (16)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Find a sequence 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]

Check the even subsequence:

Table[{n,%},{n,2,16,2}]

OpenersExampleSection1(Spacer1)Scope  (5)

Periodic sequences:

FindSequenceFunction[{-1,1,-1,1,-1,1},n]

Polynomial functions:

FindSequenceFunction[{2,5,10,17,26,37,50},n]

Rational functions:

FindSequenceFunction[{2,5/2,10/3,17/4,26/5,37/6,50/7},n]

Hypergeometric terms:

FindSequenceFunction[{1,2,6,24,120,720,5040},n]

Recurrence equations:

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]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

(RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]) works on arbitrary exact numbers or symbolic expressions:

FindSequenceFunction[{1+E,Sqrt[2]+E,2+E,2Sqrt[2]+E,4+E},n]//FullSimplify

FindSequenceFunction[{1+a,1+a^2,1+a^3,1+a^4,1+a^5},n]

OpenersExampleSection4(Spacer1)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 n containing two adjacent 1s:

Table[Count[Tuples[{1,0},n],{___,1,1,___}],{n,10}]

FindSequenceFunction[%,n]//FullSimplify

Generate a sequence from a power series expansion:

CoefficientList[Series[Exp[x^2],{x,0,20}],x]

Find its formula:

s1=FindSequenceFunction[%,n]

Use (RefLink[SeriesCoefficient, paclet:ref/SeriesCoefficient]) to find an alternative formula:

s2=SeriesCoefficient[Exp[x^2],{x,0,n}]

(RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]) assumes that sequences start with index 1:

s1=s1/.n->n+1

Compare the result:

Table[s1-s2,{n,0,20}]

Compute a finite number of Fourier coefficients:

Table[FourierCoefficient[SquareWave[x/(2Pi)],x,n],{n,1,10}]

Find the formula:

FindSequenceFunction[%,n]

Use a (RefLink[FourierCoefficient, paclet:ref/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]

Some steps:

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 (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]):

FindSequenceFunction[%,n]

OpenersExampleSection5(Spacer1)Properties & Relations  (2)

(RefLink[Sum, paclet:ref/Sum]), (RefLink[Product, paclet:ref/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]

Use (RefLink[FindGeneratingFunction, paclet:ref/FindGeneratingFunction]):

FindGeneratingFunction[{3,7,13,21,31,43,57},x]//Together

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FindLinearRecurrence, paclet:ref/FindLinearRecurrence])  ▪  (RefLink[FindRepeat, paclet:ref/FindRepeat])  ▪  (RefLink[FindTransientRepeat, paclet:ref/FindTransientRepeat])  ▪  (RefLink[FindGeneratingFunction, paclet:ref/FindGeneratingFunction])  ▪  (RefLink[Interpolation, paclet:ref/Interpolation])  ▪  (RefLink[InterpolatingPolynomial, paclet:ref/InterpolatingPolynomial])  ▪  (RefLink[RSolve, paclet:ref/RSolve])  ▪  (RefLink[Rationalize, paclet:ref/Rationalize])  ▪  (RefLink[RootApproximant, paclet:ref/RootApproximant])  ▪  (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot])  ▪  (RefLink[FindFormula, paclet:ref/FindFormula])  ▪  (RefLink[AsymptoticRSolveValue, paclet:ref/AsymptoticRSolveValue])  ▪  (RefLink[AsymptoticSum, paclet:ref/AsymptoticSum])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Discrete Calculus, paclet:guide/DiscreteCalculus])}, {▪(RefLinkPlain[Recurrence and Sum Functions, paclet:guide/RecurrenceAndSumFunctions])}, {▪(RefLinkPlain[Discrete Mathematics, paclet:guide/DiscreteMathematics])}, {▪(RefLinkPlain[Computational Systems, paclet:guide/ComputationalSystemsAndDiscovery])}, {▪(RefLinkPlain[Number Recognition, paclet:guide/NumberRecognition])}, {▪(RefLinkPlain[Integer Sequences, paclet:guide/IntegerSequences])}, {▪(RefLinkPlain[Mathematical Data, paclet:guide/MathematicalData])}})}})