Prime Notation in LaTeX (p_n)
- LaTeX command
p_n- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Subscripted p_n naming the n-th prime, so p_1 = 2, p_2 = 3, p_3 = 5.
Sequences of primes are indexed this way in results like Euclid's proof, where p_1 p_2 \cdots p_n + 1 has a prime factor outside the list, and in the asymptotic p_n \sim n\ln n from the prime number theorem. Multi-character subscripts need braces, p_{n+1}, otherwise only the n is lowered. Bertrand's postulate becomes p_{n+1} < 2p_n. The primorial, the product of the first n primes, is often written p_n\#. The prime-counting function \pi(x) is essentially the inverse of n \mapsto p_n.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Prime Notation: $p_n$
\[ p_{n+1} < 2 p_n \]
\end{document}Related symbols
- Perpendicular
\perp - Prime
p - Legendre Symbol
\left(\frac{a}{p}\right) - Phi Function
\phi(n) - Floor
\lfloor x \rfloor - Euler Phi
\varphi(n)
Frequently asked questions
- How do I write Prime Notation in LaTeX?
- Type p_n in math mode, for example $p_{n+1} < 2 p_n$. It works in plain LaTeX without loading any package.
- Which package do I need for p_n?
- None. p_n is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use p_n in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $p_n$ in running text.
Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf
Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI
- Gumawa ng magagandang TikZ diagrams gamit ang AI
- Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
- Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers