factor(2^101-1)=???



On 6/13/06, Jim FitzSimons <cherry at getnet.net> wrote:
>
>   >
> ifactor(6427752177035961102167848369947769686193797499819654815690533);
>
>
>
>    (2535301200456458802993406410901)
>
>
>
>          (2535301200456458802993406410833)
>
>
>
> >
>
> This takes a long time for Maple to factor this number.
>
> DERIVE does it in less than a second.
>

In general Maple should be better at factoring than Derive (in my
experience). Of course your example is special in the sense that the factors
are almost equal, so a special method works better than a general method. In
this case Fermat's method gives factorization very quickly:

(%i24) factor_fermat(n) := block(
    [a, b],
    a : isqrt(n),
    b : a*a-n,
    while isqrt(b)#sqrt(b) do (
        a : a+1,
        b : a*a-n
    ),
    return(a-isqrt(b))
)$
(%i25) n : 6427752177035961102167848369947769686193797499819654815690533$
(%i26) showtime:all$
Evaluation took 0.00 seconds (0.00 elapsed)
(%i27) factor_fermat(n);
Evaluation took 0.00 seconds (0.00 elapsed)
(%o27) 2535301200456458802993406410833

Your example shows that Derive probably uses Fermat's method and Maple does
not.

HTH,
Andrej