WOLFRAM

gives the Fibonacci number .

Fibonacci[n,x]

gives the Fibonacci polynomial .

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • The satisfy the recurrence relation with .
  • For any complex value of n, the are given by the general formula , where is the golden ratio.
  • The Fibonacci polynomial is the coefficient of in the expansion of .
  • The Fibonacci polynomials satisfy the recurrence relation .
  • FullSimplify and FunctionExpand include transformation rules for combinations of Fibonacci numbers with symbolic arguments when the arguments are specified to be integers using nIntegers.
  • Fibonacci can be evaluated to arbitrary numerical precision.
  • Fibonacci automatically threads over lists.
  • Fibonacci can be used with Interval and CenteredInterval objects. »

Examples

open allclose all

Basic Examples  (6)Summary of the most common use cases

Compute Fibonacci numbers:

Out[1]=1

Plot over a subset of the reals:

Out[1]=1

Plot over a subset of the complexes:

Out[1]=1

Series expansion at the origin:

Out[1]=1

Series expansion at Infinity:

Out[1]=1

Series expansion at a singular point:

Out[1]=1

Scope  (43)Survey of the scope of standard use cases

Numerical Evaluation  (6)

Evaluate numerically:

Out[1]=1
Out[2]=2

Evaluate to high precision:

Out[1]=1

The precision of the output tracks the precision of the input:

Out[2]=2

Complex number inputs:

Out[1]=1

Evaluate efficiently at high precision:

Out[1]=1
Out[2]=2

Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:

Out[1]=1
Out[2]=2

Or compute average-case statistical intervals using Around:

Out[3]=3

Compute the elementwise values of an array:

Out[1]=1

Or compute the matrix Fibonacci function using MatrixFunction:

Out[2]=2

Specific Values  (6)

Values of Fibonacci at fixed points:

Out[1]=1

Fibonacci polynomial for symbolic n and x:

Out[1]=1

Values at zero:

Out[1]=1
Out[2]=2

Find the value of in which TemplateBox[{3, x}, Fibonacci2]=5:

Out[1]=1
Out[2]=2

Compute the Fibonacci[7,x] polynomial:

Out[1]=1

Compute Fibonacci[1/2,x]:

Out[1]=1

Visualization  (5)

Plot the Fibonacci function:

Out[1]=1

Plot the Fibonacci polynomial for various orders:

Out[1]=1

Plot the real part of TemplateBox[{3, z}, Fibonacci2]:

Out[1]=1

Plot the imaginary part of TemplateBox[{3, z}, Fibonacci2]:

Out[2]=2

Plot as real parts of two parameters vary:

Out[1]=1

Types 2 and 3 of Fibonacci polynomial have different branch cut structures:

Out[1]=1
Out[2]=2

Function Properties  (14)

Fibonacci is defined for all real values:

Out[1]=1

Approximate function range of Fibonacci:

Out[1]=1
Out[2]=2

Fibonacci polynomial of an even order is odd:

Out[1]=1

Fibonacci polynomial of an odd order is even:

Out[1]=1

Fibonacci has the mirror property TemplateBox[{n}, Fibonacci](z)=TemplateBox[{n}, Fibonacci](z):

Out[1]=1

Fibonacci threads elementwise over lists:

Out[1]=1

Fibonacci is an analytic function of x:

Out[1]=1

Fibonacci is neither non-decreasing nor non-increasingfor odd values:

Out[1]=1

Fibonacci is non-decreasing for even values:

Out[2]=2

Fibonacci is not injective for odd values:

Out[1]=1
Out[2]=2

Fibonacci is not surjective for odd values:

Out[1]=1
Out[2]=2

Fibonacci is non-negative for odd values:

Out[1]=1

Fibonacci has no singularities or discontinuities:

Out[1]=1
Out[2]=2

Fibonacci is convex for odd values:

Out[1]=1

TraditionalForm formatting:

Differentiation  (3)

First derivatives with respect to n:

Out[1]=1
Out[2]=2

First derivative with respect to x:

Out[3]=3

Higher derivatives with respect to n:

Out[1]=1

Plot the higher derivatives with respect to n:

Out[2]=2

Formula for the ^(th) derivative with respect to n:

Out[1]=1

Integration  (3)

Compute the indefinite integral using Integrate:

Out[1]=1

Definite integral:

Out[1]=1

More integrals:

Out[1]=1
Out[2]=2

Series Expansions  (4)

Find the Taylor expansion using Series:

Out[1]=1

Plots of the first three approximations around :

Out[4]=4

General term in the series expansion using SeriesCoefficient:

Out[1]=1

Find the series expansion at Infinity:

Out[1]=1

Taylor expansion at a generic point:

Out[1]=1

Function Identities and Simplifications  (2)

The ordinary generating function of Fibonacci:

Out[1]=1

Recurrence relation:

Out[1]=1

Generalizations & Extensions  (2)Generalized and extended use cases

Fibonacci polynomials:

Out[1]=1

General series expansion at infinity:

Out[1]=1

Applications  (13)Sample problems that can be solved with this function

Solve the Fibonacci recurrence equation:

Out[1]=1
Out[2]=2

Solve another Fibonacci recurrence equation:

Out[3]=3
Out[4]=4

Find ratios of successive Fibonacci numbers:

Out[1]=1

Compare with continued fractions:

Out[2]=2

Convergence to the golden ratio:

Out[3]=3

Fibonacci substitution system:

Out[1]=1
Out[2]=2

Fibonomial coefficients:

Out[2]=2

Calculate the number of ways to write an integer as a sum of Fibonacci numbers :

Plot the counts for the first hundred integers:

Out[2]=2

Lamé's theorem bounds the number of steps of the Euclidean algorithm for calculating :

Plot the maximal number of steps:

Out[3]=3

Find the first Fibonacci number above 1000000:

Out[1]=1
Out[2]=2

Plot the discrete inverse of Fibonacci numbers:

Out[1]=1

Plot of the absolute value of Fibonacci over the complex plane:

Out[1]=1

Find the number of factors of Fibonacci polynomials:

Out[1]=1

If divides TemplateBox[{m}, Fibonacci], then TemplateBox[{n}, Fibonacci] divides TemplateBox[{TemplateBox[{m}, Fibonacci]}, Fibonacci]:

Out[1]=1
Out[3]=3

This is a particular case of a more general identity gcd(TemplateBox[{n}, Fibonacci],TemplateBox[{k}, Fibonacci])=TemplateBox[{{gcd, (, {n, ,, k}, )}}, Fibonacci]:

Out[4]=4

The sequence of TemplateBox[{TemplateBox[{n}, Fibonacci], m}, Mod] is periodic with respect to for a fixed natural number :

Out[1]=1

For , the period equals :

Out[2]=2

Build Zeckendorf's representation of a positive integer [MathWorld]:

Out[2]=2
Out[3]=3

Define Fibonacci multiplication for positive integers:

Fibonacci multiplication table:

Out[5]=5

Verify that the Fibonacci multiplication is associative:

Out[6]=6

Properties & Relations  (15)Properties of the function, and connections to other functions

Fibonacci Numbers  (13)

Expand in terms of elementary functions:

Out[1]=1
Out[2]=2

Limiting ratio:

Out[1]=1

Explicit recursive definition:

Out[3]=3

Explicit statespace recursive definition:

Out[4]=4

Closedform solution using MatrixPower:

Out[5]=5

Simplify expressions involving Fibonacci numbers:

Out[1]=1

Symbolic summation:

Out[1]=1

Generating function:

Out[1]=1

Fibonacci numbers as coefficients:

Out[2]=2

Express a fractional Fibonacci number as an algebraic number:

Out[1]=1

Fibonacci can be represented as a DifferenceRoot:

Out[1]=1
Out[2]=2

General term in the series expansion of Fibonacci:

Out[1]=1

The generating function for Fibonacci:

Out[1]=1
Out[2]=2

FindSequenceFunction can recognize the Fibonacci sequence:

Out[1]=1
Out[2]=2

The exponential generating function for Fibonacci:

Out[1]=1

Fibonacci Polynomials  (2)

Expand in terms of elementary functions:

Out[1]=1

Explicitly construct Fibonacci polynomials:

Out[1]=1
Out[2]=2

Possible Issues  (3)Common pitfalls and unexpected behavior

Large arguments can give results too large to be computed explicitly:

Out[1]=1

Results for integer arguments may not hold for non-integers:

Out[1]=1
Out[2]=2

Matrix power representation is valid only for integers:

Out[1]=1
Out[2]=2

Neat Examples  (8)Surprising or curious use cases

Fibonacci numbers modulo 10:

Out[1]=1
Out[2]=2

Fibonacci modulo n [more info]:

Out[1]=1

Count the number of 1, 2, ..., 9, 0 digits in the 1,000,000^(th) Fibonacci number:

Out[1]=1

Contours of vanishing real and imaginary parts of Fibonacci:

Out[1]=1

LogPlot of positive and negative Fibonacci numbers:

Out[1]=1

While the Fibonacci numbers are nondecreasing for non-negative arguments, the Fibonacci function possesses a single local minimum:

Out[1]=1

Since the generating function is rational, these sums come out as rational numbers:

Out[1]=1
Out[2]=2
Out[1]=1
Wolfram Research (1996), Fibonacci, Wolfram Language function, https://reference.wolfram.com/language/ref/Fibonacci.html (updated 2002).
Wolfram Research (1996), Fibonacci, Wolfram Language function, https://reference.wolfram.com/language/ref/Fibonacci.html (updated 2002).

Text

Wolfram Research (1996), Fibonacci, Wolfram Language function, https://reference.wolfram.com/language/ref/Fibonacci.html (updated 2002).

Wolfram Research (1996), Fibonacci, Wolfram Language function, https://reference.wolfram.com/language/ref/Fibonacci.html (updated 2002).

CMS

Wolfram Language. 1996. "Fibonacci." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2002. https://reference.wolfram.com/language/ref/Fibonacci.html.

Wolfram Language. 1996. "Fibonacci." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2002. https://reference.wolfram.com/language/ref/Fibonacci.html.

APA

Wolfram Language. (1996). Fibonacci. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Fibonacci.html

Wolfram Language. (1996). Fibonacci. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Fibonacci.html

BibTeX

@misc{reference.wolfram_2025_fibonacci, author="Wolfram Research", title="{Fibonacci}", year="2002", howpublished="\url{https://reference.wolfram.com/language/ref/Fibonacci.html}", note=[Accessed: 29-March-2025 ]}

@misc{reference.wolfram_2025_fibonacci, author="Wolfram Research", title="{Fibonacci}", year="2002", howpublished="\url{https://reference.wolfram.com/language/ref/Fibonacci.html}", note=[Accessed: 29-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_fibonacci, organization={Wolfram Research}, title={Fibonacci}, year={2002}, url={https://reference.wolfram.com/language/ref/Fibonacci.html}, note=[Accessed: 29-March-2025 ]}

@online{reference.wolfram_2025_fibonacci, organization={Wolfram Research}, title={Fibonacci}, year={2002}, url={https://reference.wolfram.com/language/ref/Fibonacci.html}, note=[Accessed: 29-March-2025 ]}