POWERMOD and EUCLID calculator programs MATH 139SPRING 2003

POWERMOD and EUCLID calculator programs
Here are versions of two programs, POWERMOD and EUCLID, for the TI-83 (or 83Plus) and TI-85 (or -86) calculators. You have to key these in, but then they'll stay in your calculator memory until the batteries run down.

[TI-83 POWERMOD] [TI-85 POWERMOD]
[TI-83 EUCLID] [TI-85 EUCLID]


POWERMOD for the TI-83

To get started, press to enter Program mode, then highlight NEW and press . The calculator prompts you for a name; use the Alpha keys to type in "POWERMOD."

Press again to get to the page where you will key in the program.

Here's the program:

:Input "BASE: ",B
:Input "EXPONENT: ",P
:Input "MODULUS: ",M
:1X
:While (P>0)
:If ((P/2)int(P/2))
:Then
:B*XX
:X-M*int(X/M)X
:P-1P
:End
:P/2P
:B^2B:B-M*int(B/M)B
:End
:Disp X

The words and symbols that may be tricky to find are

Input, in the I/O menu;
>, in the TEST menu;
, in the TEST menu;
int(), in the , NUM menu;
While, Then, and End, in the CTL menu;
Disp, in the I/O menu.


POWERMOD for the TI-85

To get started, press , then select EDIT. The calculator prompts you for a name; use the Alpha keys to type in "POWERMOD."

Press again to get to the page where you will key in the program.

Here's the program:

:Input "Base: ",B
:Input "Exponent: ",P
:Input "Modulus: ",M
:1x
:While (P>0)
:If (mod(P,2)==1)
:Then
:mod(B*x,M)x
:P-1P
:End
:P/2P
:mod(B^2,M)B
:End
:Disp x

The words and symbols that may be tricky to find are

Input, Disp and the double quote, in the I/O menu;
While, Then, and End, in the CTL menu;
mod() in the , NUM menu.


EUCLID for the TI-83

To get started, press to enter Program mode, then highlight NEW and press . The calculator prompts you for a name; use the Alpha keys to type in "EUCLID."

Press again to get to the page where you will key in the program.

Here's the program:

:Input "A: ",A
:Input "B: ",B
:1S:0T
:0U:1V
:While (B0)
:int(A/B)Q
:A-Q*BR
:BA:RB
:S-Q*UW
:T-Q*VX
:US:WU:VT:XV
:End
:Disp "S",S,"T",T,"GCD",A

The words and symbols that may be tricky to find are

Input and Disp, in the I/O menu;
< and , in the TEST menu;
int(), in the , NUM menu;
While and End, in the CTL menu;
The program prompts for two numbers, A and B, and reports the GCD of A and B, along with numbers S and T such that A*S + B*T equals GCD(A,B).


EUCLID for the TI-85

To get started, press , then select EDIT. The calculator prompts you for a name; use the Alpha keys to type in "EUCLID."

Press again to get to the page where you will key in the program.

Here's the program:

:Input "A: ",A
:Input "B: ",B
:1S:0T:0S1:1T1
:While (B0)
:int(A/B)Q
:A-Q*BR
:BA:RB
:S-Q*S1S2:T-Q*T1T2
:S1S:S2S1:T1T:T2T1
:End
:Disp "S",S,"T",T,"GCD",A

The words and symbols that may be tricky to find are

Input, Disp and the double quote, in the I/O menu;
While and End, in the CTL menu;
int() in the , NUM menu.
The program prompts for two numbers, A and B, and reports the GCD of A and B, along with numbers S and T such that A*S + B*T equals GCD(A,B).