Question: If two numbers are co - prime it means that the Greatest Common Divisor ( GCD ) of the two numbers is 1 . Write

If two numbers are co-prime it means that the Greatest Common Divisor (GCD) of the two numbers is 1. Write a program that does the following. Choose an odd number between 1 and 1000000. Find all numbers that are co-prime to this number using Euler's GCD algorithm which is the following: gcd(a, b)=gcd(b, a%b) assuming a is larger than b, i.e., the first parameter of this function is bigger than the second parameter always. The program should contain the following two functions (at least):
GCD(): to calculate GCD
main(): to start program execution Python Library Functions allowed: len(), print(), list(), str(), input(), int(), type(), chr(), ord(), range(), random.randint() and float().
Any other library functions not allowed. code in python simple way

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!