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 数論 →

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 poweredAIでLaTeXを書く

最高のAI LaTeXエディタ、Overleaf代替

Octreeは15以上の大学の研究者がAIを使って論文をより速く書くのを支援

  • AIで美しいTikZダイアグラムを生成
  • 画像をアップロードしてシームレスにLaTeXに変換
  • 論文の執筆とフォーマットに即座にサポートを取得