Private Sub Command1_Click() '快速幂程序
Dim A, B
A = Text1: B = Text2
ts = Timer
If B = 1 Then
Text3 = A
ElseIf B = 0 Then
Text3 = 1
Else
a1 = A
Do While B > 1
s = Int(Log(B) / Log(2))
s1 = 0
Do While s1 < s
A = MbC(Trim(A), Trim(A))
s1 = s1 + 1
Loop
a2 = A
B = B - 2 ^ s
A = a1
If s2 > 0 Then
a3 = MbC(Trim(a3), Trim(a2))
Else
a3 = a2
End If
s2 = s2 + 1
Loop
If B = 1 Then
js3 = MbC(Trim(a3), Trim(a1))
Else
js3 = a3
End If
s3 = Len(js3)
Text3 = "有" & s3 & "位,用时" & Timer - ts & "秒" & js3
End If
End Sub