[SciPy-user] prime factorization...

Skipper Seabold jsseabold at gmail.com
Wed Jun 17 21:43:26 EDT 2009


On Wed, Jun 17, 2009 at 1:39 PM, Joe Harrington<jh at physics.ucf.edu> wrote:
> fred <fredmfp at gmail.com>:
>>Is there any function in scipy that gives the prime factorization?
>
>>ie 50 -> [5, 5, 2]?
>
> There may be a solution in sympy:
>
> http://mail.python.org/pipermail/python-list/2008-March/653138.html
>
> There is also a linux 'factor' program that does numbers up to around 1.8e19:
>
> factor 18440000000000000000
> 18440000000000000000: 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 461
>
> If you're looking for a quick-and-dirty solution, that could be
> wrapped.  The code is likely GPL, though, so not good for integrating
> into numpy/scipy.  I'm sure there must be other code out there that
> isn't, nor are the algorithms patented.
>
> I've wanted this capability in numpy/scipy for a while.  Factoring
> seems like a basic thing you'd want, but whenever I suggest adding a
> little basic thing, people try to pile on a lot of not-basic stuff
> that then makes it inconceivable to add anything.
>
> --jh--

I was curious about this and came across Msieve which is (the only
one?) in the public domain.

http://www.boo.net/~jasonp/qs.html



More information about the SciPy-User mailing list