【发布时间】:2017-02-26 10:05:59
【问题描述】:
正如 Julia 的文档中所述(0.6 之前),可以使用 factor(n) 来完成素数分解。
它在 Julia 0.6 中不起作用。新版本的 Julia 中是否有任何软件包可以输出任何给定数字 n 的素数及其元数,因为 factor(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
【问题讨论】:
标签: julia factorization