Prime in LaTeX (p)

pp
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.

ζ(s)=∏p11−p−s\zeta(s) = \prod_{p} \frac{1}{1 - p^{-s}}
\documentclass{article}
\begin{document}
Prime: $p$

\[ \zeta(s) = \prod_{p} \frac{1}{1 - p^{-s}} \]
\end{document}

Related symbols

All Getaltheorie →

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.
Math poweredSchrijf LaTeX met AI

Beste AI LaTeX Editor, Overleaf Alternatief

Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI

  • Genereer mooie TikZ-diagrammen met AI
  • Upload afbeelding en converteer naadloos naar LaTeX
  • Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen