Download the TI-83 program |
Download the TI-92 program |
Given integer values A and B, the displayed output is two lists:
{g,s,t}
{0,u,v}
where the greatest common divisor of a and b is g and for any integer k,
g = A(s + uk) + B(t + vk).
: Disp "A"
: Input A
: Disp "B"
: Input B
: {A,1,0}->L1
: {B,0,1}->L2
: While L2(1)>0
: iPart(L1(1)/L2(1))->Q
: L1-Q*L2->L3
: L2->L1
: L3->L2
: End
: Disp L1
: L2
The following TI-92 program was written by Anthony Haroules
euclid()
Prgm
Disp "A"
Input a
Disp "B"
Input b
{a,1,0}->l1
{b,0,1}->l2
While l2[1]>0
iPart(l1[1]/l2[1])->q
l1-q*l2->l3
l2->l1
l3->l2
EndWhile
Disp l1
Disp l2
EndPrgm
TI Program page