MathGroup Archive 2000

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

Search the Archive

Re: Partition


(* just to count number of partitions *)

   PartitionsP[5]
7

(* to generate the actual partitions *)
   <<DiscreteMath`Combinatorica`

   Partitions[5]
{{5}, {4, 1}, {3, 2}, {3, 1, 1}, {2, 2, 1}, {2, 1, 1, 1}, {1, 1, 1, 1,
1}}



Kai Xiu wrote:
> 
> I am wondering how to do a partition work in Mathematica which is like
> give all the solutions of
> x_1+x_2+x_3+...+x_n=n
> where all x's are positive integers and not necessarily be different to each
> other.
> 
> Thanks,
> 
> Kai

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.       phone 413 549-1020 (H)
Univ. of Massachusetts                     413 545-2859 (W)
Amherst, MA 01003-4515


  • Prev by Date: Re: Partition
  • Next by Date: Simple Problem (I suppose...)
  • Previous by thread: Re: Partition
  • Next by thread: Re: Partition