Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Check whether the argument is a weakly decreasing list of positive integers
ResourceFunction["IntegerPartitionQ"][x] checks whether x is a weakly decreasing list of positive integers. | |
ResourceFunction["IntegerPartitionQ"][x,n] checks whether x is an integer partition of n. |
Check an integer partition:
In[1]:= | ![]() |
Out[1]= | ![]() |
Check whether it is an integer partition of 6:
In[2]:= | ![]() |
Out[2]= | ![]() |
Here are the 5 integer partitions of 4:
In[3]:= | ![]() |
Out[3]= | ![]() |
They all pass the test for being an integer partition:
In[4]:= | ![]() |
Out[4]= | ![]() |
The parts all have to be integers:
In[5]:= | ![]() |
Out[5]= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
The parts have to be positive:
In[7]:= | ![]() |
Out[7]= | ![]() |
In[8]:= | ![]() |
Out[8]= | ![]() |
The parts have to be in weakly decreasing order:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License