18 lines
380 B
Plaintext
18 lines
380 B
Plaintext
PRINT "Modular inverse."
|
|
PRINT "What is the modulus?"
|
|
INPUT M
|
|
PRINT "What number is to be inverted?"
|
|
INPUT X
|
|
PRINT "Solution is:"
|
|
10 LET A = A + 1
|
|
GOTO 20
|
|
15 IF B = 1 THEN PRINT A
|
|
IF B = 1 THEN END
|
|
IF A = M-1 THEN PRINT "nonexistent"
|
|
IF A = M-1 THEN END
|
|
GOTO 10
|
|
20 LET B = A*X
|
|
30 IF B < M THEN GOTO 15
|
|
LET B = B - M
|
|
GOTO 30
|