正如Julia的文档(0.6之前)所述,素数分解可以通过使用因子(N)来完成。
它在Julia 0.6中不起作用。在新版本的Julia中是否有任何软件包可以输出任意给定数字的素数因子和它们的正则性,就像下面(文档中的)所示的(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
https://stackoverflow.com/questions/42467136
复制相似问题