Prime in LaTeX (p)
- LaTeX command
p- Package
- No package needed: built into LaTeX
- Mode
- Text and math mode
Where it is used
Lowercase italic p, the conventional letter for a prime number in number theory.
By convention p, and q for a second prime, denote primes, so statements like 'for every prime p' or sums and products indexed by p need little further explanation. Euler's product \zeta(s) = \prod_p (1 - p^{-s})^{-1} is the classic case where the index runs over primes implicitly. Typing p in math mode gives the italic letter; keep it in math mode in prose too, so it matches the displays. To avoid ambiguity with probabilities or p-values, state the convention early. Prime powers are written p^k, and the p-adic numbers \mathbb{Q}_p.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Prime: $p$
\[ \zeta(s) = \prod_{p} \frac{1}{1 - p^{-s}} \]
\end{document}Related symbols
- Prime Notation
p_n - Phi Function
\phi(n) - Perpendicular
\perp - Euler Phi
\varphi(n) - Legendre Symbol
\left(\frac{a}{p}\right) - Modulo
\pmod{n}
Frequently asked questions
- How do I write Prime in LaTeX?
- Type p in math mode, for example $\zeta(s) = \prod_{p} \frac{1}{1 - p^{-s}}$. It works in plain LaTeX without loading any package.
- Which package do I need for p?
- None. p is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use p in text mode, or only in math mode?
- Both. p compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf
يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي
- أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
- ارفع صورة وحولها إلى LaTeX بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث