MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Partition Function


"Shug Boabby" <Shug.Boabby at gmail.com> wrote in message 
news:d7k3qf$ooq$1 at smc.vnet.net...
> hi there,
>
> is there any way to get mathematica to return the actual partitions of
> an integer? the only functions related to this, (e.g.
> http://mathworld.wolfram.com/PartitionFunctionP.html) only return the
> *number* of partitions, not the actual partititons (including
> permutations) themselves.
>
> e.g. for 4, i'd like a function to return
> {{1,1,1,1}, {2,1,1}, {1,2,1}, {1,1,2}, {3,1}, {2,2}, {1,3}, {4}}
>
> with the ordering of the partitions not being important
>
> cheers,
> Shug
>

Needs["DiscreteMath`Combinatorica`"]

Flatten[Permutations /@ Partitions[4], 1]
{{4}, {3, 1}, {1, 3}, {2, 2}, {2, 1, 1}, {1, 2, 1}, {1, 1, 2}, {1, 1, 1, 1}}

Carl Woll 



  • Prev by Date: Re: mml files
  • Next by Date: Re: computing the area inside a contour plot
  • Previous by thread: Partition Function
  • Next by thread: Re: Partition Function