标题:各位老师好!求助编辑一个大整数的快速乘除法可调用程序
只看楼主
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
回复 390楼 xianfajushi
谢谢回复,200万是说的啥数据呀?我怎么不明白呢?
2022-03-25 13:14
xianfajushi
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:8
帖 子:527
专家分:690
注 册:2007-9-8
得分:0 
今天兴致完善了一下除法求余补〇,结果与无补〇完全一致,如图:

那么51梅森数求余就是没错误的了,难道是次方错了?
2022-04-11 10:00
xianfajushi
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:8
帖 子:527
专家分:690
注 册:2007-9-8
得分:0 
77774777888888888888888888888888889999999999
198737927
---------------------------------------------------------------------------3
1815339978
---------------------------------------------------------------------------9
266986358
---------------------------------------------------------------------------1
682484318
---------------------------------------------------------------------------3
862705378
---------------------------------------------------------------------------4
677536708
---------------------------------------------------------------------------3
813229278
---------------------------------------------------------------------------4
1827757088----------------------------------------------------------0
---------------------------------------------------------------------------9
391157458
---------------------------------------------------------------------------1
1924195318
---------------------------------------------------------------------------9
1355539758
---------------------------------------------------------------------------6
1631121968
---------------------------------------------------------------------------8
412185528
---------------------------------------------------------------------------2
1470967488----------------------------------------------------------0
---------------------------------------------------------------------------7
798019998
---------------------------------------------------------------------------4
306829088------------------------------------------------------------0
---------------------------------------------------------------------------1
1080911618
---------------------------------------------------------------------------5
872219838
---------------------------------------------------------------------------4
772681308
---------------------------------------------------------------------------3
1764675278
---------------------------------------------------------------------------8
1747718628
---------------------------------------------------------------------------8
1578152128
---------------------------------------------------------------------------7
1869866398
---------------------------------------------------------------------------9
812250559
---------------------------------------------------------------------------4
1729885199----------------------------------------------------------0
---------------------------------------------------------------------------8
1399817839
---------------------------------------------------------------------------7
865235099------------------------------------------------------------0
---------------------------------------------------------------------------4
702833919
---------------------------------------------------------------------------3
1066201389
---------------------------------------------------------------------------5
725117549
---------------------------------------------------------------------------3
1289037689
---------------------------------------------------------------------------6
96610127
2022-04-11 10:03
xianfajushi
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:8
帖 子:527
专家分:690
注 册:2007-9-8
得分:0 
验证2^11-1=2047不是质数如图,从而验证次方与除法求余程序是正确的。


[此贴子已经被作者于2022-4-12 15:27编辑过]

2022-04-12 15:11
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
回复 388楼 wmf2014
python编程如何学习?本论坛有这个栏目吗?

[此贴子已经被作者于2022-6-22 00:07编辑过]

2022-06-21 22:23
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
快速判断大素数的程序:(从text1到text2)
分段筛选素数表.zip (22.25 KB)
2022-08-28 15:31
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
292752622924000738929990585203与292752622924000738929990605203之间有12对差大于200的素数对:
292752622924000738929990590003/252
292752622924000738929990590893/426
292752622924000738929990592987/246
292752622924000738929990594193/546
292752622924000738929990595471/222
292752622924000738929990596191/704
292752622924000738929990598091/292
292752622924000738929990598793/240
292752622924000738929990599953/236
292752622924000738929990602057/318
292752622924000738929990603949/266
292752622924000738929990605063/234
用时3681.472秒

这段有个704的间距,数据显示程序在1小时内最多只能判断1万个30位的奇数,如何提高速度呢?


[此贴子已经被作者于2022-9-28 06:00编辑过]

2022-09-28 05:57
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
Private Sub Command1_Click()
'研究某数蔡氏素数的程序
Dim a, b
a = Trim(Text1)
a1 = a
q = Trim(Text2)

If Right(a, 1) Mod 2 = 0 Then
a = a + 1
Else
a = a
End If
m = MPC(Trim(a), 1)
s = 0
Do While m <= q And p1 < Val(q)
Do While a < Val(m)
Do While InStr(fenjieyinzi0(Trim(a)), "*") > 0
a = MPC1(Trim(a), 2)
Loop

p1 = a
p2 = MPC(Trim(m), Trim(p1))
p3 = MPC1(Trim(p2), 60)
p4 = MPC1(Trim(p2), "1180591620717411303420")
Print p1
If Val(p2) > 0 And InStr(fenjieyinzi0(Trim(p1)), "*") = 0 And InStr(fenjieyinzi0(Trim(p2)), "*") = 0 And InStr(fenjieyinzi0(Trim(p3)), "*") = 0 And InStr(fenjieyinzi0(Trim(p4)), "*") = 0 Then
Text3 = Text3 & "2m=" & m & "p1=" & p1 & "p2=" & p2 & "p3=" & p3 & "p4=" & p4 & vbCrLf
s = s + 1
s103 = s103 & "/" & m

Else
m = m
End If

a = MPC1(Trim(a), 2)

Loop
m = MPC1(Trim(m), 2)
a = 3
Loop

Text4 = q & "内的不同偶数" & s103
Combo1 = "从" & a1 & "到" & q & "内有" & s & "组蔡氏偶数有" & Val(s) & "个不同的偶数" & Text3

End Sub
2022-09-28 06:52
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
判断大素数的代码:

Private Function fenjieyinzi0(sa As String) As String
Dim a, n
n = Trim(sa)
If Len(n) < 11 Then
fenjieyinzi0 = fenjieyinzi(Trim(n))
Else
n1 = MPC(Trim(n), 1)
a = 123
'a为明文
a1 = zzxc(Trim(n), Trim(a))
If Val(a1) > 1 Then
fenjieyinzi0 = a1 & "*"
Else
c = 999
'c为公约
Do While zzxc(Trim(n1), Trim(c)) > 1
c = Val(c - 1)
Loop
d = qniyuan(Trim(c), Trim(n1))
'd为逆元为私钥
a2 = qksmimo(Trim(a), Trim(c), Trim(n))
'a2为密文
a3 = qksmimo(Trim(a2), Trim(d), Trim(n))
If MBJC(Trim(a3), Trim(a)) = 0 Then
fenjieyinzi0 = "这是素数有"
Else
fenjieyinzi0 = "2*2"
End If
End If
End If


End Function
2022-09-28 06:55
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
1000002100内有1组蔡氏素数:
1000001329,9173994463960286046443283581208347763186259956673124494950355357547691504353939232280074212440503746219891,9173994463960286046443283581208347763186259956673124494950355357547691504353939232280074212440503746219893,4n+2=9173994463960286046443283581208347763186259956673124494950355357547691504353939232280074212440502746218562
用时9692.083秒(其中有一对106位的孪生素数)
2022-10-11 16:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-499181-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.295071 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved