Fibonacci in LaTeX (F_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.
\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
- Partition
p(n) - Cycle
C_n - Derangement
D_n - Bell Number
B_n - Double Factorial
n!! - Stirling Second Kind
\genfrac{\{}{\}}{0pt}{}{n}{k}
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 poweredAI로 LaTeX 작성
최고의 AI LaTeX 편집기, Overleaf 대안
Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움
- AI로 아름다운 TikZ 다이어그램 생성
- 이미지를 업로드하고 LaTeX로 원활하게 변환
- 논문 작성 및 서식에 대한 즉각적인 지원 받기