Fibonacci in LaTeX (F_n)

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

Try Fibonacci in a real LaTeX document

Open a ready-to-compile document that already uses F_n, with the right packages loaded. Edit it and see the PDF, no install needed.

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 التوافقيات →

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 poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث