2016-08-15 62 views
0

大的數字,我想在此公式中來計算X:計算在VB.Net

R = G^x的模N = B

和變量:

Dim g As Double 
    Dim x As Double 
    Dim n As Double 
    Dim b As Double 
    Dim m As Double 
    Dim r As Double 
    x = 1 
    b = 9789467 
    g = 10895499 
    n = 16777216 
    m = 1 

這裏我的代碼:

Dim i As Integer 
For i = 1 To 16777215 

    m = i 
    r = (g^m) Mod n 

    If r = b Then 
     MsgBox("result = " + i) 
    End If 
Next 

MsgBox("not found") 

,但是,它只是適用於小的數字 和我的號碼......沒有工作:( 我希望得到任何解決方案傢伙:) 甚至如果u任何其他語言得到的x值......這是細:) 謝謝:)

+0

如果它只是得到的'價值x'不管你可以用任何語言[WolframAlpha的(HTTP:/ /www.wolframalpha.com/input/?i=10895499+%5E+x+mod+16777216+%3D+9789467)這種東西 – Sehnsucht

+0

謝謝@Sehnsucht ...它的工作:) –

回答

0

增加提及System.Numerics和使用的BigInteger