Brent's variation of a factorization algorithm

n00m n00m at narod.ru
Wed Dec 9 20:37:27 EST 2009


On Dec 10, 2:59 am, Irmen de Jong <irmen.NOS... at xs4all.nl> wrote:
> On 12/10/09 12:52 AM, n00m wrote:
>
> > On Dec 10, 1:11 am, Irmen de Jong<ir... at -nospam-xs4all.nl>  wrote:
> >> 999999999
> >> == 27 * 37037037
>
> >> What gives? Isn't this thing supposed to factor numbers into the product
> >> of two primes?
>
> >> -irmen
>
> > Only if you yield to it a SEMIprime =)
>
> A 'semiprime' being a product of 2 prime numbers, I suppose.
>
> >> 27 * 37037037
> > Now you can apply brent() to these numbers, and so on
>
> Right :)   I more or less expected it to do that by itself (didn't look
> at the algorithm)
>
> But you wrote that it might run indefinately if you feed it a prime
> number. There's no safeguard then against getting into an endless loop
> if you keep applying brent() to the factors it produces? Because in the
> end one or both factors will be prime...
>
> -irmen


Just to use e.g. Rabin-Miller's before supplying a number to brent()

> A 'semiprime' being a product of 2 prime numbers, I suppose.

Aha, exactly.
==============================
Also it's worthy to test a num is it a perfect square?
But all this is obvious trifles...



More information about the Python-list mailing list