This is falling back to factor() for generic integers, so the GMP method 
does not looked to be wrapped.  The generic version will be terribly slow 
for bigints.  Would be easy to add if you would like to submit a Pull 
Request.

julia> N = big(3)^100 + 2
515377520732011331036461129765621272702107522003

julia> @which factor(N)
factor{T<:Integer}(n::T<:Integer) at primes.jl:79

Link to implementation 
<https://github.com/JuliaLang/julia/blob/d87e303e6b74b5e36bfa58a20d9404c3d1d53415/base/primes.jl#L78>


On Friday, March 13, 2015 at 1:20:16 PM UTC-4, Hans W Borchers wrote:
>
> I got interested in factorizing some larger integers such as N = 3^100 + 2 
> .
> In all tries, factor(N) did not return and had to be interrupted:
>
>     julia> N = big(3)^100 + 2
>     julia> factor(N)
>     ^CERROR: interrupt
>      in finalizer at ./base.jl:126
>      in + at gmp.jl:243
>      in factor at primes.jl:111
>
> It is calling GMP, but the GMP software cannot be the reason as this works 
> with the GMP package in R and returns the factorization within seconds:
>
>     R> library(gmp)
>     R> N <- bigz(3)^100
>     R> factorize(N)
>     Big Integer ('bigz') object of length 3:
>     [1] 31721   246451584544723     65924521656039679831393482841
>     R> system.time(factorize(N))
>      user  system elapsed 
>     3.738   0.000   3.730
>
> Is this a bug? Did I do something wrong?
> The first factor, 31721, is not even large. Mathematical software such as 
> GAP or PARI/GP will factorize this in much less than a second.
>
> PS: Versioninfo
>     Julia Version 0.3.6; System: Linux (x86_64-linux-gnu)
>     CPU: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz; WORD_SIZE: 64
>     BLAS: libblas.so.3; LAPACK: liblapack.so.3
>     LIBM: libopenlibm; LLVM: libLLVM-3.3
>

Reply via email to