As stated in Julia's documentation (before 0.6), prime factorization can be done by using factor(n).
It is not working in Julia 0.6. Is there any package in new versions of Julia that outputs prime factors along with their arity for any given number n as factor(n) does shown below (from the documentation)?
factor(n) → Dict
Compute the prime factorization of an integer n.
Returns a dictionary. The keys of the dictionary correspond to the factors, and hence are of the same type as n.
The value associated with each key indicates the number of times the factor appears in the factorization.
julia> factor(100) # == 2*2*5*5
Dict{Int64,Int64} with 2 entries:
2 => 2
5 => 2
This was moved to the package Primes.jl.
A deprecation warning is provided in Julia v0.5, and the function is completely removed in v0.6.
julia> VERSION
v"0.5.0"
julia> factor(100)
ERROR: factor(100,) has been moved to the package Primes.jl.
Run Pkg.add("Primes") to install Primes on Julia v0.5-
in factor(::Int64, ::Vararg{Int64,N}) at ./deprecated.jl:210
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With