Wolfram Research

Function Repository Resource:

NextIntegerPartition (1.0.0) current version: 1.0.1 »

Source Notebook

Get the next partition of an integer in reverse lexicographic order

Contributed by: Sriram V. Pemmaraju and Steven S. Skiena, submitted by Wolfram staff

ResourceFunction["NextIntegerPartition"][p]

gives the integer partition following p in reverse lexicographic order.

Examples

Basic Examples (1) 

The partition of an integer following the given one in the reverse lexicographic order:

In[1]:=
ResourceFunction["NextIntegerPartition"][{1, 2, 3}]
Out[1]=

Properties and Relations (1) 

NextIntegerPartition[p] gives the successor to p in the list returned by IntegerPartitions:

In[2]:=
ResourceFunction["NextIntegerPartition"][{5}]
Out[2]=
In[3]:=
IntegerPartitions[5]
Out[3]=

Version History

  • 1.0.1 – 17 April 2023
  • 1.0.0 – 02 March 2020

Related Resources

License Information