
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Homework 10 :
divisor, written ๐๐๐ (๐, ๐), is the largest common divisor of m and n. Write a function to find the greatest common divisor (gcd) of two numbers in two ways (recursive and not recursive).
that gcd(a, b) = sa + tb. Write a function to find s and t.
(hint: if ๐ = ๐ ร ๐, check_prime(p) and check_prime(q)โฆ).
๐๐๐๐(๐, ๐) = ( 7 โ ๐๐๐๐(๐ โ 1 , ๐) + 1 ) mod ๐, Where a seed ๐๐๐๐( 0 , ๐) = s (import time s = time.time()). b) Write function shuffle(alist) to shuffle items in alist. (Hint: swap alist[i] and alist[rand(i,n)])