PartitionsP[n]
gives the number p(n) of unrestricted partitions of the integer n.
PartitionsP
PartitionsP[n]
gives the number p(n) of unrestricted partitions of the integer n.
Details
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- PartitionsP automatically threads over lists.
Examples
open all close allBasic Examples (2)
Scope (3)
Compute the number of partitions for large numbers:
Table[PartitionsP[2 ^ k], {k, 0, 12}]PartitionsP threads element-wise over lists:
PartitionsP[{2, 4, 6}]TraditionalForm formatting:
PartitionsP[n]//TraditionalFormApplications (3)
Number of non‐isomorphic Abelian groups of order n:
Table[Times@@PartitionsP[Last /@ FactorInteger[n]], {n, 12}]Compare to FiniteAbelianGroupCount:
Table[FiniteAbelianGroupCount[n], {n, 12}]Compare cumulative counts of even and odd partitions:
ListPlot[Accumulate[Table[Mod[PartitionsP[k], 2], {k, 1000}]] / Range[1000]]Visualize p-adic valuations of the number of partitions:
ArrayPlot[Mod[Table[IntegerExponent[Table[PartitionsP[n], {n, 120}], k], {k, 2, 120}], 2]]Properties & Relations (4)
PartitionsP gives the length of IntegerPartitions:
IntegerPartitions[5]PartitionsP[5]Obtain values of PartitionsP from series expansion:
Series[1 / QPochhammer[t], {t, 0, 20}]Use FullSimplify to simplify expressions containing PartitionsP:
FullSimplify[Mod[PartitionsP[5n + 4], 5] == 0, Element[n, Integers] && n > 0]FindSequenceFunction can recognize the PartitionsP sequence:
Table[PartitionsP[n], {n, 10}]FindSequenceFunction[%, n]Possible Issues (1)
PartitionsP evaluates only for integer arguments:
PartitionsP[12.1]Use Simplify to find implicit integers in arguments:
PartitionsP[12 + (E + 1) ^ 2 - Expand[(E + 1) ^ 2]]Simplify[%]Neat Examples (2)
Successive differences of PartitionsP modulo 2:
ArrayPlot[Mod[NestList[Differences, PartitionsP[Range[100]], 100], 2]]A "random" walk based on PartitionsP:
ListLinePlot[ReIm /@ Accumulate[Exp[3.4 Pi I PartitionsP[Range[500]]]]]See Also
PartitionsQ DedekindEta IntegerPartitions FiniteAbelianGroupCount
Function Repository: PartitionRank PartitionCrank
Related Links
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), PartitionsP, Wolfram Language function, https://reference.wolfram.com/language/ref/PartitionsP.html.
CMS
Wolfram Language. 1988. "PartitionsP." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PartitionsP.html.
APA
Wolfram Language. (1988). PartitionsP. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PartitionsP.html
BibTeX
@misc{reference.wolfram_2026_partitionsp, author="Wolfram Research", title="{PartitionsP}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/PartitionsP.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_partitionsp, organization={Wolfram Research}, title={PartitionsP}, year={1988}, url={https://reference.wolfram.com/language/ref/PartitionsP.html}, note=[Accessed: 12-June-2026]}