MathGroup Archive 2002

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

Search the Archive

Reciprocal Sums


Hello,
I need your help to resolve this question (I give a example for n=12):

In[1]:= << DiscreteMath`Combinatorica`

In[2]:= n = 12;

In[3]:= p = Partitions[n];


Now, I want to get from p thouse partitions which reciprocal sum is a 
integer.

In[4]:= r = Cases[p, x_ /; IntegerQ[Plus @@ (1/x)]]

Out[4]:= {{6, 3, 2, 1}, {4, 4, 2, 1, 1}, {3, 3, 3, 1, 1, 1}, {2, 2, 2, 2, 2, 
2}, {2, 2,2, 2, 1, 1, 1, 1}, {2, 2, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1}}

But, is n is a big number, then you have to wait a big number of seconds to 
get r.

Any suggestion to do that better-faster?

Best regard
Juan


_________________________________________________________________
Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es



  • Prev by Date: Re: How to separate imaginary unit inside an arbitrary function?
  • Next by Date: PDF Format
  • Previous by thread: Re: confusion with triple integral...
  • Next by thread: Re: Reciprocal Sums