han*_*ugm 0 factorization julia
正如Julia的文档(0.6之前)所述,可以使用因子(n)来完成素数因子分解.
它不适用于Julia 0.6.新版本的Julia中是否有任何软件包输出素数因子以及任何给定数字n的arity,因为(n)因子如下所示(来自文档)?
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
Run Code Online (Sandbox Code Playgroud)
这被转移到包Primes.jl.
Julia v0.5中提供了弃用警告,该函数在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
Run Code Online (Sandbox Code Playgroud)