Ask Question
30 May, 17:23

Write a function gcd (x, y) that returns the greatest common divisor of the parameters candy. You can use the Euclidean algorithm, which uses the fact that gcd (x, y) = gcd (modx, x). Say you want to nd the gcd of 462 and 1071

+2
Answers (1)
  1. 30 May, 18:12
    0
    In some language, the function can be written recursively using the correct Euclidean algorithm as ...

    gcd[y_, x_] : = If[Mod[y, x]==0, x, gcd[x, Mod[y, x]]]

    Using this on the given numbers, you get ...

    gcd[462, 1071] = 21
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function gcd (x, y) that returns the greatest common divisor of the parameters candy. You can use the Euclidean algorithm, which ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers