数学中国

 找回密码
 注册
搜索
热搜: 活动 交友 discuz
楼主: ysr

[程序原创]大整数的除法

[复制链接]
 楼主| 发表于 2021-8-25 07:29 | 显示全部楼层
本帖最后由 ysr 于 2021-8-26 04:35 编辑

Private Sub Command1_Click()
Dim a, n
n = Trim(Text1)
ts = Timer
If Len(n) < 11 Then
Text2 = fenjieyinzi(Trim(n))
If InStr(Text2, "*") = 0 Then
Text2 = "这是素数,有" & Len(n) & "位,用时" & Timer - ts & "位"
Else
Text2 = "*这是合数,有" & Len(n) & "位,用时" & Timer - ts & "秒"
End If
Else
n1 = MPC(Trim(n), 1)
a = 3
'a为明文
a1 = zzxc(Trim(n), Trim(a))
If Val(a1) > 1 Then
Text2 = a1 & "*这是合数,有" & Len(n) & "位,用时" & Timer - ts & "秒"
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
Text2 = "这是素数有" & Len(n) & "位,用时" & Timer - ts & "秒"
Else
Text2 = "*这是合数,有" & Len(n) & "位,用时" & Timer - ts & "秒"
End If
End If
End If
End Sub

明文的长度是1位数是可行的,原理是有效的,当然某些特殊值比如0和1都是不行的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-3-17 17:00 | 显示全部楼层
重大成果:其他论坛一位网友计算(2^99368963-1)mod 198737927的结果不超过1秒钟,说明人家的程序速度快效率高,结果是2^99368963-1可以被198737927整除。

评分

参与人数 1威望 +20 收起 理由
wlc1 + 20 赞一个!

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|数学中国 ( 京ICP备05040119号 )

GMT+8, 2024-3-28 19:00 , Processed in 0.062500 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表