Algorithm for extracting the prime factors of an integer

P_spam_ at draigBrady.com P_spam_ at draigBrady.com
Thu Jan 2 07:05:41 EST 2003


Luca Bruderer wrote:
> Hi
> 
> I'm wondering which is the best algorithm to do this.

Erm there is some deep math involved with this.
I would suggest "prime factorization" in google.

This works on linux at least :-)

os.popen("factor 1234").readline().split()[1:]

Pádraig.





More information about the Python-list mailing list