list of remainder

lawrence shared this question 1 month ago
Answered

need to know how get list of all remainders when a divides b ( using euclidean algorithm) until remainder equals zero and return last non zero remainder.

by transalating the below statement to geogebra statements.

Input r(0) ,r(1) where r(0)>r(1)

initialisation i=1

Do

i=i+1

r(i)=r(i-2) mod(r(i-1))

while r(i) is not=0

return k=r(i-1)

any help or suggestion is much appreciated. Thanks

Comments (5)

photo
1

a=162
b=12
l1={}

SetValue(l1,IterationList(Mod(p,q), p, q, {a,b}, b))

c=Min(KeepIf(x>0, l1))

photo
1

how to exclude first 2 numbers. , a and b (973,301) in set l1 which are not the remainders when a/b iteratively. Thanks

photo
photo
1

l1\{a,b}

photo
1

thanks so much!

photo
© 2019 International GeoGebra Institute