PartitionsQ[n]
gives the number q(n) of partitions of the integer n into distinct parts.
PartitionsQ
PartitionsQ[n]
gives the number q(n) of partitions of the integer n into distinct parts.
Details
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- PartitionsQ automatically threads over lists.
Examples
open all close allBasic Examples (2)
Scope (3)
Compute the number of partitions for large numbers:
PartitionsQ[100000]PartitionsQ threads element-wise over lists:
PartitionsQ[{2, 4, 6}]TraditionalForm formatting:
PartitionsQ[n]//TraditionalFormApplications (3)
Compare cumulative counts of even and odd partitions into distinct parts:
ListPlot[Accumulate[Table[Mod[PartitionsQ[k], 2], {k, 1000}]] / Range[1000]]Plot the ratio of the number of partitions with its asymptotic value:
ListPlot[Table[PartitionsQ[k] / ((E^π Sqrt[(k/3)]/4 3^1 / 4 k^3 / 4)), {k, 1000}]]Visualize p-adic valuations of the number of partitions:
ArrayPlot[Mod[#, 2]&@Table[IntegerExponent[Table[PartitionsQ[n], {n, 120}], k], {k, 2, 120}]]Properties & Relations (4)
PartitionsQ gives the length of IntegerPartitions with nonrepeating parts:
IntegerPartitions[5]PartitionsQ[5]Generate the explicit partitions:
Select[IntegerPartitions[5], Max[Length /@ Split@ #] == 1&]Model PartitionsQ based on the definition:
Table[Length[Select[IntegerPartitions[n], Sort[#] == Union[#]&]], {n, 12}]Table[PartitionsQ[n], {n, 12}]Obtain values of PartitionsQ from series expansion:
Series[1 / QPochhammer[t, t ^ 2], {t, 0, 20}]FindSequenceFunction can recognize the PartitionsQ sequence:
Table[PartitionsQ[n], {n, 10}]FindSequenceFunction[%, n]Possible Issues (1)
PartitionsQ evaluates only for explicit integers:
PartitionsQ[12.1]Use Simplify to find implicit integers in arguments:
PartitionsQ[12 + (E + 1) ^ 2 - Expand[(E + 1) ^ 2]]Simplify[%]Neat Examples (2)
Successive differences of PartitionsQ modulo 2:
ArrayPlot[Mod[NestList[Differences, PartitionsQ[Range[100]], 100], 2]]A "random" walk based on PartitionsQ:
ListLinePlot[ReIm /@ Accumulate[Exp[3.4 Pi I PartitionsQ[Range[500]]]]]See Also
Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), PartitionsQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PartitionsQ.html.
CMS
Wolfram Language. 1988. "PartitionsQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PartitionsQ.html.
APA
Wolfram Language. (1988). PartitionsQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PartitionsQ.html
BibTeX
@misc{reference.wolfram_2026_partitionsq, author="Wolfram Research", title="{PartitionsQ}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/PartitionsQ.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_partitionsq, organization={Wolfram Research}, title={PartitionsQ}, year={1988}, url={https://reference.wolfram.com/language/ref/PartitionsQ.html}, note=[Accessed: 12-June-2026]}