Partition in LaTeX (p(n))

p(n)p(n)
LaTeX command
p(n)
Package
No package needed: built into LaTeX
Mode
Text and math mode

Where it is used

Partition function p(n): the number of ways to write n as a sum of positive integers, ignoring order.

For example, p(4) = 5 because 4 = 3+1 = 2+2 = 2+1+1 = 1+1+1+1. Euler's generating function is \sum_n p(n) x^n = \prod_{k \geq 1} \frac{1}{1 - x^k}, and Hardy and Ramanujan found the asymptotic p(n) \sim \frac{1}{4n\sqrt{3}} e^{\pi\sqrt{2n/3}}. Ramanujan's congruences include p(5k+4) \equiv 0 \pmod 5. The lowercase p clashes with probability density notation and with primes, so define it in mixed contexts. Restricted versions are written p_k(n) or p(n, k) for partitions into at most k parts.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

∑n≥0p(n) xn=∏k=1∞11−xk\sum_{n \geq 0} p(n)\, x^n = \prod_{k=1}^{\infty} \frac{1}{1 - x^k}
\documentclass{article}
\begin{document}
Partition: $p(n)$

\[ \sum_{n \geq 0} p(n)\, x^n = \prod_{k=1}^{\infty} \frac{1}{1 - x^k} \]
\end{document}

Related symbols

All 組み合わせ論 →

Frequently asked questions

How do I write Partition in LaTeX?
Type p(n) in math mode, for example $\sum_{n \geq 0} p(n)\, x^n = \prod_{k=1}^{\infty} \frac{1}{1 - x^k}$. 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?
Both. p(n) 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に変換
  • 論文の執筆とフォーマットに即座にサポートを取得