Prime Notation in LaTeX (p_n)

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

pn+1<2pnp_{n+1} < 2 p_n
\documentclass{article}
\begin{document}
Prime Notation: $p_n$

\[ p_{n+1} < 2 p_n \]
\end{document}

Related symbols

All نظرية الأعداد →

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.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث