[seqfan] Re: next partition into distinct parts

Juan Arias de Reyna arias at us.es
Sun Feb 13 11:13:01 CET 2011


Since you want distinct parts:

Needs["Combinatorica`"];

DistinctNextPartition[A_] := Module[{B, H, b, h},
  B = NextPartition[A];
  b = Length[B];
  H = Union[B];
  h = Length[H];
  While[h < b,
   B = NextPartition[B];
   b = Length[B]; 
   H = Union[B];
   h = Length[H]];
  Return[B]]

Best regards,
Juan Arias de Reyna




El 13/02/2011, a las 07:13, David Newman escribió:

> Does anyone out there have a Mathematica program which will give the
> next partition into distinct parts?
> 
> For example given the partition    {11 , 4 , 2}  as input, it should
> output  {11  ,3  ,2 , 1}.
> 
> If someone has such a program or can  easily write one, I'd like to have it.
> 
> _______________________________________________
> 
> Seqfan Mailing list - http://list.seqfan.eu/




More information about the SeqFan mailing list