ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
399
399
EMPFEHLEN
-
Hallo Leute,
ich habe ein Problem. Ich möchte aus den beiden zahlen 17231805556577 und 17231797254335 die Teilerfremd sind also GTT = 1, den Modulen Invers bzw. die Modulen inverse heraus bekommen. Ich habe aber keine ahnung wie ich das Programmierteschnisch abbilden soll oder muss
lg
-
So jetzt habe ich mal was versucht.
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
private long[] extEucl(long a, long b){ long aa = a; long bb = b; long x0 = 1; long x1 = 0; long y0 = 0; long y1 = 1; long x = 0; long y = 1; if(b == 0){ x = 1; //alfa y = 0; //beta b = a; //gcd } else if(a != 0){ long r, q; q = Math.DivRem(a, b,out r); //quotient & remainder while(r != 0){ x = x0 - q*x1; y = y0 - q*y1; x0 = x1; y0 = y1; x1 = x; y1 = y; a = b; b = r; q = Math.DivRem(a, b, out r); } } long[] v_return = {0,0,0}; v_return[0] = x; v_return[1] = y; v_return[2] = b; return v_return; //alfa(inverse),beta,gcd }
Sobald ich da aber zahlen reinjage bekomme ich 1 zurück. Das Problem ist nun wenn ich die Zahlen hardcodiert reinschreibe geht es sobald ich aber diese übergeben lasse was ich ja machen will, geht es nicht
Ähnliche Themen
-
Modulare Exponentation
Von Cromon im Forum C/C++Antworten: 1Letzter Beitrag: 06.11.10, 14:15 -
Inverse Kinematik
Von ich im Forum Cinema 4DAntworten: 8Letzter Beitrag: 01.08.09, 09:40 -
Cinema r11 Inverse Kinematik
Von Robbobking im Forum Cinema 4DAntworten: 3Letzter Beitrag: 24.06.09, 16:13 -
Inverse Kinematik
Von Matthias im Forum Cinema 4DAntworten: 3Letzter Beitrag: 15.10.04, 14:50 -
IK (Inverse Kinematic) in C4d 5.0 XL
Von Lebbomatic im Forum Sonstige 3D-ProgrammeAntworten: 1Letzter Beitrag: 21.06.01, 15:09





Zitieren
Login





