Fibonacci in LaTeX (F_n)

FnF_n
LaTeX command
F_n
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Fibonacci number F_n, defined by F_0 = 0, F_1 = 1 and F_n = F_{n-1} + F_{n-2}.

Fibonacci numbers start 0, 1, 1, 2, 3, 5, 8, 13 and have the closed form F_n = (\varphi^n - \psi^n)/\sqrt{5}, Binet's formula, where \varphi = (1+\sqrt5)/2 is the golden ratio. They count tilings of a 1 \times n board with squares and dominoes (F_{n+1} of them) and appear in the analysis of Euclid's algorithm and Fibonacci heaps. Some texts start the indexing at F_1 = F_2 = 1, so state your initial values. Use \varphi for the golden ratio as most authors do; \phi is the straight variant. Braces are needed for F_{n-1}.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

Fn=Fn−1+Fn−2,Fn=φn−ψn5F_n = F_{n-1} + F_{n-2}, \quad F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}}
\documentclass{article}
\begin{document}
Fibonacci: $F_n$

\[ F_n = F_{n-1} + F_{n-2}, \quad F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}} \]
\end{document}

Related symbols

All Kombinatorik →

Frequently asked questions

How do I write Fibonacci in LaTeX?
Type F_n in math mode, for example $F_n = F_{n-1} + F_{n-2}, \quad F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}}$. It works in plain LaTeX without loading any package.
Which package do I need for F_n?
None. F_n is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use F_n in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $F_n$ in running text.
Math poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI

  • Jana diagram TikZ yang cantik menggunakan AI
  • Muat naik imej dan tukar ke LaTeX dengan lancar
  • Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan