首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >julia 0.6中的素数分解

julia 0.6中的素数分解
EN

Stack Overflow用户
提问于 2017-02-26 18:05:59
回答 3查看 1.7K关注 0票数 1

正如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
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2017-02-26 18:22:08

这被移到了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
票数 9
EN

Stack Overflow用户

发布于 2018-12-18 05:08:59

运行:Pkg.add(素数) Pkg.update()以更新所有

运行:使用(Primes)编译包

系数(100)

票数 2
EN

Stack Overflow用户

发布于 2019-10-29 18:14:09

  • 运行import Pkg; Pkg.add("Primes")以安装primes软件包。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42467136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档