【Mathematica】把偶数写成两个素数的和

 时间:2025-01-05 08:34:03

1、先枚举2n拆分成两个素数和的方法:pr[n_]:=DeleteCases[If[PrimeQ[#]&&PrimeQ[2*n-#],{#,2*n-#},0]&/@Range[3,n,2],0]那么,容易验证160有8种分拆方法:pr[80]

【Mathematica】把偶数写成两个素数的和

2、可视化,就是把这些点画出来:ListPlot[pr[80],AspectRatio->Automatic]//Image

【Mathematica】把偶数写成两个素数的和

3、把6到160之间所有的偶数,全部分拆:points=pr[#]&/@Range[6,160,2]

【Mathematica】把偶数写成两个素数的和

4、把这些点画出来:ListPlot[points,AspectRatio->Automatic]

【Mathematica】把偶数写成两个素数的和

5、600到1000之间的偶数分拆:ListPlot[pr[#]&/@Range[300,500,2],PlotRange->{300,1000},AspectRatio->Automatic]

【Mathematica】把偶数写成两个素数的和

6、2000到2200之间的偶数分拆:ListPlot[pr[#]&/@Range[1000,1100,2],PlotRange->{1000,2200}]

【Mathematica】把偶数写成两个素数的和

7、考察分拆的方法数目:Show[ListPlot[{#,Length[pr[#]]}&/@Range[6,100,2],PlotStyle->Orange],ListLinePlot[{#,Length[pr[#]]}&/@Range[6,100,2]]]

【Mathematica】把偶数写成两个素数的和

8、把直角坐标转化为极坐标:Length[pr[#]]*{Cos[# Degree],Sin[# Degree]}

【Mathematica】把偶数写成两个素数的和

9、Length[pr[#]]*{Cos[2# Degree],Sin[2# Degree]}:

【Mathematica】把偶数写成两个素数的和

10、把6到7200之间的偶数分拆,方法数转化为极坐标形式的可视化:Length[pr[#]]*{Cos[2# Degree],Sin[2# Degree]}&/@Range[6,3600,2]

【Mathematica】把偶数写成两个素数的和
  • 如何使用mathematica对列表元素进行排序?
  • Mathematica基础——再谈素数
  • mathematic Table用法
  • Mathematica怎么批量处理列表中的元素?
  • Mathematica 只进行一次的替换操作
  • 热门搜索
    做包子怎么发面视频 图片怎么做成视频 生育险怎么交 新陈代谢慢怎么办 和怎么读 澳门航空怎么样 刘备是怎么死的 我的世界怎么打开背包 怎么看图纸 西门子洗衣机怎么样