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 Combinatorics →

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 poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers