Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
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

View file

@ -0,0 +1,27 @@
REM Modular inverse
LET E=42
LET T=2017
GOSUB 100
PRINT M
END
REM Increments E S (step) times until B is greater than T
REM Repeats until B = 1 (MOD = 1) and C (count)
REM B will not be greater than T + E
100 LET D=0
IF E>=T THEN GOTO 130
LET B=E
REM At least one iteration is necessary
LET S=((T-B)/E)+1
LET B=B+S*E
LET C=1+S
LET B=B-T
110 IF B=1 THEN GOTO 120
LET S=((T-B)/E)+1
LET B=B+S*E
LET C=C+S
LET B=B-T
GOTO 110
120 LET D=C
130 LET M=D
RETURN