数学中国

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

数论问题巅峰对决

[复制链接]
发表于 2021-6-17 05:25 | 显示全部楼层
  b1=198,   b2=  ?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-17 10:03 | 显示全部楼层

b1=198而204与10000之间的素数打头有8组差为2和10002*m-m和2的4生素数对: (用时0.328125秒)b2的值为
/118801/600
/421741/2130
/463321/2340
/540541/2730
/617761/3120
/991981/5010
/1324621/6690
/1865161/9420
最小值为600
回复 支持 反对

使用道具 举报

发表于 2021-6-17 10:59 | 显示全部楼层
  b1 分别为 228,240,270,282,

  b2 分别为    ?      ?      ?      ?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-17 20:05 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:57 编辑
蔡家雄 发表于 2021-6-17 02:59
b1 分别为 228,240,270,282,

  b2 分别为    ?      ?      ?      ?


b1=228而234与10000之间的素数打头有4组差为2和10002*m-m和2的4生素数对: (用时0.390625秒)b2=
/269/271/61559/61561/270
/2309/2311/526679/526681/2310
/4259/4261/971279/971281/4260
/7349/7351/1675799/1675801/7350
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-17 20:06 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:58 编辑

当b1=228时,b2=270.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-17 20:11 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:56 编辑

b1=240而246与10000之间的素数打头有12组差为2和10002*m-m和2的4生素数对: (用时0.484375秒)b2=
/419/421/100799/100801/420
/461/463/110879/110881/462
/641/643/154079/154081/642
/1229/1231/295199/295201/1230
/2141/2143/514079/514081/2142
/3539/3541/849599/849601/3540
/3581/3583/859679/859681/3582
/4271/4273/1025279/1025281/4272
/4337/4339/1041119/1041121/4338
/6089/6091/1461599/1461601/6090
/8537/8539/2049119/2049121/8538
/8819/8821/2116799/2116801/8820


在家呢,家里的电脑慢的多。


回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-17 20:30 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:55 编辑

b1=270而276与10000之间的素数打头有7组差为2和10002*m-m和2的4生素数对: (用时0.453125秒)b2=
/1721/1723/464939/464941/1722
/1949/1951/526499/526501/1950
/3251/3253/878039/878041/3252
/3299/3301/890999/891001/3300
/4517/4519/1219859/1219861/4518
/4721/4723/1274939/1274941/4722
/7559/7561/2041199/2041201/7560


回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-18 07:48 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:54 编辑




b1=282而288与10000之间的素数打头有3组差为2和10002*m-m和2的4生素数对: (用时0.40625秒)b2=
/809/811/228419/228421/810
/7349/7351/2072699/2072701/7350
/8009/8011/2258819/2258821/8010

点评

1194,1224,1284加1,都不是素数,  发表于 2021-6-18 08:02
1194,1224,1284加1,都不是素数,  发表于 2021-6-18 08:00
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-18 11:01 | 显示全部楼层
ysr 发表于 2021-6-17 23:48
b1=282而288与10000之间的素数打头有17组差为2和10002*m-m和2的4生素数对: (用时52.57031秒)b2=
/1193/11 ...

程序错了,没有判断b5,改进一下。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-18 11:25 | 显示全部楼层
本帖最后由 ysr 于 2021-6-18 04:52 编辑

程序代码如下;
Private Function zhengchuqyushu(sa As String) As String
If InStr(sa, "/") = 0 Then
zhengchuqyushu = 0
Else
zhengchuqyushu = Mid(sa, InStr(sa, "/") + 1)
End If


End Function


Private Function zhengchuqy(sa As String) As String
If InStr(sa, "/") = 0 Then
zhengchuqy = sa
Else
zhengchuqy = Left(sa, InStr(sa, "/") - 1)
End If


End Function


Public Function MBBC(D1 As String) As String 'kai pingfang
If Len(D1) < 10 Then
jss = Int(Sqr(D1))
JW = Val(D1) - (jss) ^ 2
  If JW = 0 Then
  MBBC = jss
  Else
  MBBC = jss & "/" & JW
    End If
Else
Dim X 'shuju changdu
X = Len(D1) \ 4
D2 = String(4 - Len(D1) + 4 * X, "0") & D1
Dim A() As String
ReDim A(4 To 4 * X + 4)
Dim B() As String
ReDim B(2 To 2 * X)
Dim I, J, js
  For I = 4 To 4 * X + 4 Step 4
  
A(I) = Mid(D2, I - 3, 4)
js = Int(Sqr(Val(A(4) & A(8))))
JW = Val(A(4) & A(8)) - (js) ^ 2
Next
   J = 4
   Do While J <= 2 * X
   
   jws = MPC1(JW & "0000", A(2 * J + 4))
   If MBJC(Trim(jws), MbC(Trim(js), 200)) <= 0 Then
    B(J) = "00"
    Else
    jwc = Left(jws, Len(jws) - Len(MbC(Trim(js), 200)) + 2) \ Left(MbC(Trim(js), 200), 2)
    If Len(jwc) > 2 Then
     B(J) = 99
     Else
     B(J) = jwc
     End If
   
     
     Do While MBJC(Trim(jws), MbC(MPC1(B(J), MbC(Trim(js), 200)), B(J))) = -1
     
     B(J) = B(J) - 1
     
               Loop
          End If
          JW = MPC(Trim(jws), MbC(MPC1(MbC(200, Trim(js)), B(J)), B(J)))
      
     js = MPC1(MbC(Trim(js), 100), Trim(B(J)))
     
      
   J = J + 2
   If JW = 0 Then
      
   MBBC = js
   Else
   MBBC = js & "/" & JW
   End If
   Loop
   
End If
End Function

Public Function MBJC(D1 As String, D2 As String) As String ';bijiao
If Len(D1) <= 10 And Len(D2) <= 10 Then
If Val(D1) > Val(D2) Then
MBJC = 1
Else
If Val(D1) = Val(D2) Then
MBJC = 0
Else
MBJC = -1
End If
End If
Else

If Len(D1) > Len(D2) Then
MBJC = 1
Else
If Len(D1) < Len(D2) Then
MBJC = -1
Else
If Len(D1) = Len(D2) Then
Dim X, Y
X = Len(D1) \ 4: Y = Len(D2) \ 4
Dim A() As String, B() As String
ReDim A(4 To 4 * X + 4)
ReDim B(4 To 4 * Y + 4)
If Val(Left(D1, Len(D1) - 4 * X)) > Val(Left(D2, Len(D2) - 4 * Y)) Then
  MBJC = 1
  Else
  If Val(Left(D1, Len(D1) - 4 * X)) < Val(Left(D2, Len(D2) - 4 * Y)) Then
  MBJC = -1
  Else
  For I = 4 To 4 * X Step 4
  A(I) = Mid(D1, Len(D1) - I + 1, 4)
  B(I) = Mid(D2, Len(D2) - I + 1, 4)
  Next
  J = 4 * X
  Do While A(J) = B(J) And J >= 8
  
  J = J - 4
     Loop
     
     
   If Val(A(J)) - Val(B(J)) > 0 Then
   MBJC = 1
   Else
   If Val(A(J)) - Val(B(J)) < 0 Then
   MBJC = -1
   Else
   MBJC = 0
   End If
   
  End If
  
  
  
End If
End If
End If
End If
End If
End If
End Function

Public Function MCC(D1 As String, D2 As String) As String ';除数少于8位的除法
If Len(D1) < Len(D2) Then
   MCC = "0" & "/" & D1
   Else
   If Len(D1) < 9 Then
    MCC = Val(D1) \ Val(D2) & "/" & Val(D1) - (Val(D1) \ Val(D2)) * Val(D2)
     If Mid(MCC, InStr(MCC, "/") + 1) = 0 Then
  MCC = Left(MCC, InStr(MCC, "/") - 1)
Else
MCC = MCC
End If
   
    Else
   
   Dim X ';fen duan changdu
   X = Len(D1)
   
     
   
     Dim A() As String
      ReDim A(1 To X)  ';定义数组的储存空间
      For I = 1 To X Step 1  ';把被除数各位放在a()中
       A(I) = Mid(D1, I, 1)
        
      
       Next I
      Dim B() As String
      JW = 0
     ReDim B(1 To X)
     For J = 1 To X Step 1
    B(J) = Val(JW & A(J)) \ Val(D2)
      JW = Val(JW & A(J)) - Val(B(J)) * Val(D2)
       Next J
       For r = 1 To X
       If JW = 0 Then
          MCC = MCC & B(r)
          Else
          CJ = CJ & B(r)
          MCC = CJ & "/" & JW
      
    End If
   
    For I = 1 To Len(MCC)
   If Not Mid(MCC, I, 1) = "0" Then
       Exit For
   End If
Next
strTmp = Mid(MCC, I)
If Len(strTmp) = 0 Then
MCC = "0"
Else
MCC = strTmp
End If
   
   Next
   
   End If
     
     End If
   
End Function

Public Function MCC1(D1 As String, D2 As String) As String ';大整数的除法
Dim ss
ss = MBJC(D1, D2)
If ss = -1 Then
MCC1 = "0" & "/" & D1
  Else
  If ss = 0 Then
   MCC1 = 1
   Else
   If Len(D1) = Len(D2) Then
     s = Val(Left(D1, 1)) \ Val(Left(D2, 1))

Do While MBJC(MbC(Trim(s), Trim(D2)), D1) = 1
  s = s - 1
  Loop
  If MBJC(MbC(Trim(s), Trim(D2)), D1) = 0 Then
   MCC1 = s
   Else
   MCC1 = s & "/" & MPC(Trim(D1), MbC(Trim(s), Trim(D2)))

End If
    Else
    If Len(D2) < 9 Then
     MCC1 = MCC(D1, D2)
     Else
    Dim X, Y ';定义分段长度
    X = Len(D1): Y = Len(D2)
   
Dim JW, jcc, jss, jcs

  Dim A() As String, B() As String
  
  ReDim A(1 To X)
  ReDim B(1 To Y)
  For I = 1 To X
  A(I) = Mid(D1, I, 1)
  Next
  For J = 1 To Y
  B(J) = Mid(D2, J, 1)
  Next
  jcc = Val(A(1) & A(2)) \ Val(B(1) & B(2))
   
      
        
  jss = MbC(Trim(jcc), D2)
   For i1 = 1 To Y
    jws = jws & A(i1)
      Next
      
      Do While MBJC(Trim(jws), Trim(jss)) = -1
      jcc = jcc - 1
      jss = MbC(Trim(jcc), D2)
      Loop
  JW = MPC(Trim(jws), Trim(jss))
  
    z = X - Y
   
    Dim c() As String
    ReDim c(1 To z)
    For s = 1 To z
     If MBJC(JW & A(s + Y), D2) = -1 Then
       c(s) = "0"
       Else
     jwc = Val(Left(JW & A(s + Y), 3)) \ Val(Left(D2, 2))
      If Len(jwc) > 1 Then
      c(s) = "9"
       Else
        c(s) = jwc
         End If
      
     Do While MBJC(JW & A(s + Y), MbC(Val(c(s)), D2)) = -1
    c(s) = Right(10000 + Val(c(s) - 1), 1)
     Loop
     End If
   
     JW = MPC(JW & A(s + Y), MbC(Val(c(s)), D2))
     
    jcc = jcc & c(s)
    Next s
    If JW = 0 Then
    MCC1 = jcc
    Else
    MCC1 = jcc & "/" & JW
    End If
   
  For I = 1 To Len(MCC1)
    If Not Mid(MCC1, I, 1) = "0" Then
        Exit For
    End If
Next
strTmp = Mid(MCC1, I)
  If Len(strTmp) = 0 Then
  MCC1 = "0"
  Else
MCC1 = strTmp
End If
   
    End If
   
  End If
End If
End If
End Function

Public Function MbC(D1 As String, D2 As String) As String
Dim X, Y ';两数长度
X = Len(D1) \ 4: Y = Len(D2) \ 4
D3 = String(4 * X + 4 - Len(D1), "0") & D1
D4 = String(4 * Y + 4 - Len(D2), "0") & D2
X = X + 1: Y = Y + 1
Dim A() As String
ReDim A(4 To 4 * X + 4 * Y, 4 To 4 * Y)
Dim I, J, C1, C2, CJ, JW, s, t
For J = 4 * Y To 4 Step -4 ';D2
JW = 0 ';进位清0
C2 = Mid(D4, J - 3, 4) ';每位数
For I = 4 * X To 4 Step -4 ';D1
C1 = Mid(D3, I - 3, 4) ';每位数
CJ = Val(C1) * Val(C2) + JW ';计算乘积
c = I + J: r = 4 * Y + 4 - J
A(c, r) = String(4 - Len(CJ Mod 10000), "0") & CJ Mod 10000 ';本位
JW = CJ \ 10000 ';进位
Next
A(c - 4, r) = JW
Next
Dim B() As String
ReDim B(1 To X + Y)
JW = 0
For s = X + Y To 1 Step -1
Bit = JW
For t = 1 To Y
Bit = Bit + Val(A(4 * s, 4 * t))
Next
B(s) = String(4 - Len(Bit Mod 10000), "0") & Bit Mod 10000
JW = Bit \ 10000
Next
If B(1) > 0 Then
MbC = Val(Left(MbC, 5)) & Mid(MbC, 6) & B(1)
Else
MbC = Val(Left(MbC, 5)) & Mid(MbC, 6)
End If
For s = 2 To X + Y
MbC = Val(Left(MbC, 5)) & Mid(MbC, 6) & B(s)
Next
End Function

'该程序已经做了修改,不是去掉前导0的问题,是补够前导0的问题。


Public Function MPC(D1 As String, D2 As String) As String ';jianfaqi
  Dim X, Y ';两数长度
  If qqdl(D2) = "0" Then
  MPC = D1
  Else
If Len(D1) >= Len(D2) Then
  D4 = String(Len(D1) - Len(D2), "0") & D2
  D3 = D1
  Else
  D4 = D2
  D3 = String(Len(D2) - Len(D1), "0") & D1
  End If
  X = Len(D3) \ 8: Y = Len(D4) \ 8
  D3 = String(8 * X + 8 - Len(D3), "0") & D3
  D4 = String(8 * Y + 8 - Len(D4), "0") & D4
  X = X + 1: Y = Y + 1
  
  Dim A() As String, B1() As String, C1() As String, E1() As String
  ReDim A(1 To X)
  ReDim B1(1 To Y)
  ReDim C1(1 To X)
  ReDim E1(1 To X)
  Dim I, J, C2, CJ, JW
  For J = Y To 1 Step -1 ';D2
  JW = 1 ';yu jie weichuzhi
  B1(J) = Mid(D4, J * 8 - 7, 8) ';每位数
For I = X To 1 Step -1  ';D1
     A(I) = Mid(D3, I * 8 - 7, 8) ';每位数
   C1(I) = Val(1 & A(I)) - Val(B1(I)) - Val(1) + Val(JW) ';计算jia
   If Len(C1(I)) <= 8 Then
   JW = 0
   C1(I) = String(8 - Len(C1(I)), "0") & C1(I)
   Else
     JW = Left(C1(I), Len(C1(I)) - 8)
     End If
     E1(I) = Right(C1(I), 8)
     If Len(E1(I)) < 8 Then
     E1(I) = String(8 - Len(E1(I)), "0") & E1(I)
     Else
     E1(I) = E1(I)
     End If
     
    Next
    Next
    For r = 1 To X
    MPC = MPC & E1(r)
    If Len(MPC) > Len(D1) Then
    MPC = Mid(MPC, Len(MPC) - Len(D1) + 1)
    Else
    MPC = MPC
    End If
    For I = 1 To Len(MPC)
      If Not Mid(MPC, I, 1) = "0" Then
          Exit For
      End If
  Next
  strTmp = Mid(MPC, I)
    If Len(strTmp) = 0 Then
    MPC = "0"
    Else
  MPC = strTmp
  End If
    Next
   End If
   
  End Function

Public Function MPC1(D1 As String, D2 As String) As String 'jiafa
  Dim X, Y, JW '两数长度

If Len(D1) >= Len(D2) Then
  D4 = String(Len(D1) - Len(D2), "0") & D2
  D3 = D1
  Else
  D4 = D2
  D3 = String(Len(D2) - Len(D1), "0") & D1
  End If
  X = Len(D3) \ 8: Y = Len(D4) \ 8
  If 8 * X < Len(D3) Then
  D3 = String(8 * X + 8 - Len(D3), "0") & D3
  D4 = String(8 * Y + 8 - Len(D4), "0") & D4
  X = X + 1: Y = Y + 1
  Else
  X = X: Y = Y
  D3 = D3: D4 = D4
  End If
  Dim A() As String, B1() As String, C1() As String, E1() As String
  ReDim A(1 To X)
  ReDim B1(1 To Y)
  ReDim C1(1 To X)
  ReDim E1(1 To X)
  Dim I, J, C2, CJ
  For J = Y To 1 Step -1 'D2
  JW = 0 '进位清0
  B1(J) = Mid$(D4, J * 8 - 7, 8) '每位数
For I = X To 1 Step -1  'D1
     A(I) = Mid$(D3, I * 8 - 7, 8) '每位数
   C1(I) = Val(A(I)) + Val(B1(I)) + Val(JW) '计算jia
   If Len(C1(I)) < 8 Then
   C1(I) = String(8 - Len(C1(I)), "0") & C1(I)
   Else
   C1(I) = C1(I)
   End If
     JW = Left(C1(I), Len(C1(I)) - 8)
     E1(I) = Right(C1(I), 8)
    Next
    Next
    For r = 1 To X
    If JW = 0 Then
    MPC1 = MPC1 & E1(r)
    Else
    jc = jc & E1(r)
    MPC1 = JW & jc
    End If
    Next
   MPC1 = qqdl(Trim(MPC1))
  End Function
  
  Private Function qqdl(sa As String) As String

  
  For I = 1 To Len(sa)
    If Not Mid(sa, I, 1) = "0" Then
        Exit For
    End If
Next
strTmp = Mid(sa, I)
  If Len(strTmp) = 0 Then
  qqdl = "0"
  Else
qqdl = strTmp
End If
End Function


Private Function zzxc(sa As String, sb As String) As String
Dim A, B, c, d, r
  A = Trim(sa)
  B = Trim(sb)
  If Len(A) < 10 And Len(B) < 10 Then
  
  If Val(A) > Val(B) Then
     c = A
     d = B
  Else
     c = B
     d = A
  End If
Do Until Val(c) Mod Val(d) = 0
     r = c Mod d
     c = d
     d = r
  Loop
  
  Else
  
  If MBJC(Trim(A), Trim(B)) >= 1 Then
  c = A
  d = B
  Else
  c = B
  d = A
  End If
  Do Until zhengchuqyushu(MCC1(Trim(c), Trim(d))) = 0
  r = zhengchuqyushu(MCC1(Trim(c), Trim(d)))
  c = d
  d = r
  Loop
  End If

  
  zzxc = d
  
End Function

Private Function qniyuan(sa As String, sb As String) As String
Dim n, p, A, B, c, d, r
  n = Trim(sa)
  p = Trim(sb)
  A = 1
  B = 0
  c = 0
  d = 1
  If Len(n) < 10 And Len(p) < 10 Then
  
  If Val(n) > Val(p) Then
     m = n
     q = p
     s1 = 1
  Else
     m = p
     q = n
     s1 = 0
  End If
Do Until Val(m) Mod Val(q) = 0
    s = m \ q
     r = m Mod q
     s1 = s1 + 1
     If s1 Mod 2 = 1 Then
     A = A
     B = A * s + B
     c = c
     d = c * s + d
     Else
     B = B
     A = A + B * s
     d = d
     c = c + d * s
     End If
     m = q
     q = r
  Loop
  If Val(A + B * m) = p Then
  B = B
  A = A + B * (m - 1)
  d = d
  c = c + d * (m - 1)
  Else
  If Val(B + A * m) = p Then
  A = A
  B = B + A * m
  c = c
  d = d + c * m
  Else
  B = B
  A = A + B * (m - 1)
  d = d
  c = c + d * (m - 1)
  End If
  End If
X = (A + B) Mod p
  Y = (c + d) Mod n
  
  
  Else
  
  If MBJC(Trim(n), Trim(p)) >= 1 Then
  m = n
  q = p
  s1 = 1
  Else
  m = p
  q = n
  s1 = 0
  End If
  Do Until zhengchuqyushu(MCC1(Trim(m), Trim(q))) = 0
  s = zhengchuqy(MCC1(Trim(m), Trim(q)))
  r = zhengchuqyushu(MCC1(Trim(m), Trim(q)))
  s1 = s1 + 1
  If s1 Mod 2 = 1 Then
  A = A
  B = MPC1(MbC(Trim(A), Trim(s)), Trim(B))
  c = c
  d = MPC1(MbC(Trim(c), Trim(s)), Trim(d))
  Else
  B = B
  A = MPC1(Trim(A), MbC(Trim(B), Trim(s)))
  d = d
  c = MPC1(Trim(c), MbC(Trim(d), Trim(s)))
  End If
  
  m = q
  q = r
  Loop
  
  If MPC1(Trim(A), MbC(Trim(B), Trim(m))) = p Then
  B = B
  A = MPC1(Trim(A), MbC(Trim(B), MPC(Trim(m), 1)))
  d = d
  c = MPC1(Trim(c), MbC(Trim(d), MPC(Trim(m), 1)))
  Else
  If MPC1(Trim(B), MbC(Trim(A), Trim(m))) = p Then
  A = A
  B = MPC1(Trim(B), MbC(Trim(A), Trim(m)))
  c = c
  d = MPC1(Trim(d), MbC(Trim(c), Trim(m)))
  Else
  B = B
  A = MPC1(Trim(A), MbC(Trim(B), MPC(Trim(m), 1)))
  d = d
  c = MPC1(Trim(c), MbC(Trim(d), MPC(Trim(m), 1)))
  End If
  End If
Do While Left(A, 1) = "0"
    A = Mid(A, 2)
Loop
  
  End If
  
  qniyuan = A
End Function

Private Function qksmimo(sa As String, sb As String, sc As String) As String
Dim c, e, n, d
c = Trim(sa)
e = Trim(sb)
n = Trim(sc)
d = 1
If Len(c) < 5 And Len(e) < 5 And Len(n) < 5 Then
c = Val(c): n = Val(n)
Do While e > 0
If Right(e, 1) Mod 2 = 0 Then
c = c * c Mod n
e = e / 2

Else
d = d * c Mod n
e = e - 1
End If
Loop
Else
c = c
Do While MBJC(Trim(e), 1) >= 0
If Right(e, 1) Mod 2 = 0 Then
c = zhengchuqyushu(MCC1(MbC(Trim(c), Trim(c)), Trim(n)))
e = zhengchuqy(MCC1(Trim(e), 2))
Else
d = zhengchuqyushu(MCC1(MbC(Trim(c), Trim(d)), Trim(n)))
e = MPC(Trim(e), 1)
End If
Loop
End If

qksmimo = d
End Function

Private Function fenjieyinzi(sa As String) As String
Dim X, A, B
X = sa
B = Int(Sqr(Val(X)) / 2)
If X = 3 Or X = 2 Then
A = True
Else
If X Mod 2 = 0 Then
A = False
Else

For I = 3 To 2 * B + 1 Step 2
If X Mod I = 0 Then
A = False
Exit For

Else: A = True

End If
Next
End If
End If
If A = True Then
fenjieyinzi = "这是个素数"
Else
fenjieyinzi = "2*2"
End If

End Function


Private Sub Command1_Click() '求由2个孪生素数对组成的4生素数组的程序
Dim A, B
A = Val(Text1)
a1 = A
q = Val(Text2)
m = Sqr(q)
t = Val(Text4)
t1 = t
ts = Timer
If Right(A, 1) Mod 2 > 0 Then
A = A + 1
Else
A = A
End If
s = 0
a3 = A - 1
a2 = a3 + 2
Do While t <= m
Do While InStr(fenjieyinzi0(Trim(a2)), "*") > 0 Or InStr(fenjieyinzi0(Trim(a3)), "*") > 0
a3 = a2 + 2
a2 = a3 + 2
Loop
B1 = a2
B2 = MPC(MbC(Trim(A), Trim(t)), 1)
b3 = MPC1(Trim(B2), 2)
b4 = t - 1
B5 = t + 1
C4 = fenjieyinzi(Val(b4))
C5 = fenjieyinzi(Val(B5))
C1 = fenjieyinzi(Val(B1))
C2 = fenjieyinzi(Trim(B2))
C3 = fenjieyinzi(Trim(b3))
If InStr(C1, "*") = 0 And InStr(C2, "*") = 0 And InStr(C3, "*") = 0 And InStr(C4, "*") = 0 And InStr(C5, "*") = 0 Then
s = s + 1
Print B1, B2
Text3 = Text3 & "/" & b4 & "/" & B5 & "/" & B2 & "/" & b3 & "/" & t & vbCrLf
Else
s = s
End If
t = t + 6

Loop

s1 = s
Do While t <= q
Do While InStr(fenjieyinzi0(Trim(a2)), "*") > 0 Or InStr(fenjieyinzi0(Trim(a3)), "*") > 0
a3 = a2 + 2
a2 = a3 + 2
Loop
B1 = a2
B2 = MPC(MbC(Trim(A), Trim(t)), 1)
b3 = MPC1(Trim(B2), 2)
b4 = t - 1
B5 = t + 1
C4 = fenjieyinzi(Val(b4))
C5 = fenjieyinzi(Val(B5))
C1 = fenjieyinzi(Val(B1))
C2 = fenjieyinzi(Trim(B2))
C3 = fenjieyinzi(Trim(b3))
If InStr(C1, "*") = 0 And InStr(C2, "*") = 0 And InStr(C3, "*") = 0 And InStr(C4, "*") = 0 And InStr(C5, "*") = 0 Then
s1 = s1 + 1
Print B1, B2
Text3 = Text3 & "/" & b4 & "/" & B5 & "/" & B2 & "/" & b3 & "/" & t & vbCrLf
Else
s1 = s1
End If
t = t + 6

Loop
Combo1 = "b1=" & a1 & "而" & t1 & "与" & q & "之间的素数打头有" & s1 & "组差为2和" & t & "*m-m和2的4生素数对: (用时" & Timer - ts & "秒)b2=" & vbCrLf & Text3

End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Combo1 = ""
Form1.Cls
End Sub

Private Function fenjieyinzi0(sa As String) As String
Dim A, n
n = Trim(sa)
If Len(n) < 6 Then
fenjieyinzi0 = fenjieyinzi(Trim(n))
Else
n1 = MPC(Trim(n), 1)
A = 615
'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

回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-5 05:20 , Processed in 0.088868 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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