Re: math - need divisors algorithm

2005-04-07 Thread Peter Schorn
Philp Smith wrote: Hi Does anyone have suggested code for a compact, efficient, elegant, most of all pythonic routine to produce a list of all the proper divisors of an integer (given a list of prime factors/powers) What about # Returns a list of all divisors of n = a1^e1*a2^e2* ... *an^en whe

Re: math - need divisors algorithm

2005-04-05 Thread David Eppstein
> > Does anyone have suggested code for a compact, efficient, elegant, most of > > all pythonic routine to produce a list of all the proper divisors of an > > integer (given a list of prime factors/powers) I have code for this in (look for t

Re: math - need divisors algorithm

2005-03-31 Thread Joal Heagney
Ed Suominen wrote: Philp Smith wrote: Hi Does anyone have suggested code for a compact, efficient, elegant, most of all pythonic routine to produce a list of all the proper divisors of an integer (given a list of prime factors/powers) Is this compact enough? :-) def properDivisors(N): return

Re: math - need divisors algorithm

2005-03-30 Thread Ed Suominen
Philp Smith wrote: > Hi > > Does anyone have suggested code for a compact, efficient, elegant, most of > all pythonic routine to produce a list of all the proper divisors of an > integer (given a list of prime factors/powers) Is this compact enough? :-) def properDivisors(N): return [x for

Re: math - need divisors algorithm

2005-03-30 Thread Philp Smith
excellent - thanks in the meantime I managed to write something myself which a)works b)looks reasonably elegant and pythonic but c) is recursive d) requires a mainroutine and co-routine I have a feeling if I analysed it it would prove to be relatively inefficient as I'm sure it creates

Re: math - need divisors algorithm

2005-03-30 Thread Tim Peters
[Philp Smith] > Does anyone have suggested code for a compact, efficient, elegant, most of > all pythonic routine to produce a list of all the proper divisors of an > integer (given a list of prime factors/powers) If the canonical factorization of N is the product of p_i**e_i, the number of diviso

math - need divisors algorithm

2005-03-29 Thread Philp Smith
Hi Does anyone have suggested code for a compact, efficient, elegant, most of all pythonic routine to produce a list of all the proper divisors of an integer (given a list of prime factors/powers) -- http://mail.python.org/mailman/listinfo/python-list