Partition Problem

Peter Hansen peter at engcorp.com
Fri Jul 13 23:38:08 EDT 2001


Donovan Hide wrote:

> Basically how can I find all the sets of six numbers which sum to 17 and
> also to 20. 

There are zero sets of six numbers which sum both to 17 and to 20?  ;-)

>     I have come across algorithms written twenty years ago, but they are
> written in Pascal and Fortran. I am learning to program with Python, so it
> is difficult to translate them. I would be very grateful if someone could
> supply some c, python or even pseudocode to generate the solution to this
> problem.

If you have algorithms, why not post them?  Are you hoping somebody
will write this from scratch just for you?  (Someone might, but he's
in a different timezone and wasting his time creating it.comp.lang.python,
and _still_ hasn't replied since you posted this 13 hours ago, so you 
might be out of luck. :)

> Also is generation the correct phrase or is enumeration better?

Enumeration means counting or listing one by one.  That presupposes
the items being counted or listed exist.  Generation means to
bring into being.

So do the sets you are looking for already exist or not?  I'm 
fairly sure a mathematician would say you want enumeration...

(http://www.dictionary.com was instrumental in forming my response.
I'd also like to thank my mother and my father, and my first
grade teacher Mrs. Hurry.)
-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list