About 141,000 results
Open links in new tab
  1. Code for Greatest Common Divisor in Python - Stack Overflow

    Jun 24, 2012 · The greatest common divisor (GCD) of a and b is the largest number that divides both of them with no remainder. One way to find the GCD of two numbers is Euclid’s algorithm, which is …

  2. algorithm - Python gcd for list - Stack Overflow

    Mar 22, 2015 · 37 As of python 3.9, python got built-in support for calculating gcd over a list of numbers.

  3. python - Euclidean algorithm (GCD) with multiple numbers ... - Stack ...

    python math greatest-common-divisor edited May 18, 2013 at 19:33 asked May 18, 2013 at 19:19 Tetramputechture

  4. Euclidean Algorithm / GCD in Python - Stack Overflow

    Sep 19, 2015 · 6 I'm trying to write the Euclidean Algorithm in Python. It's to find the GCD of two really large numbers. The formula is a = bq + r where a and b are your two numbers, q is the number of …

  5. How to find greatest common divisor using recursive function in …

    Dec 2, 2019 · I am asked to find the greatest common divisor of integers x and y using a recursive function in Python. The condition says that: if y is equal to 0 then gcd (x,y) is x; otherwise gcd(x,y) is …

  6. python - Compute the greatest common divisor and least common …

    Nov 27, 2022 · You can use Euclidian algorithm if you want to find greatest common divisor or in your terms highest common factor (HCF): here is the link to the article in FreeCodeCamp.org Here is the …

  7. python - Find the greatest common divisor - Stack Overflow

    Mar 16, 2013 · Putting these together will make your while loop's condition not biggest % ans and not smallest % ans. Finally, you can use a better algorithm than trying every value one by one. Euclid's …

  8. greatest common divisor (python) - Stack Overflow

    Nov 17, 2020 · python greatest-common-divisor edited Nov 17, 2020 at 22:52 Yunnosch 26.8k 9 45 62

  9. python - How to compute the Greatest Common Divisor? - Stack …

    In case you were wondering, greatest common divisors are in the standard library: __import__('fractions').gcd(21, 28). Also, I'm pretty sure that after the first return, you could do return …

  10. python - finding GCD using for loop - Stack Overflow

    Jan 9, 2022 · I am trying to find the Greatest Common Divisor of 2 numbers using for loop, when I enter 2 numbers and one is divided by second without reminder it returns a correct answer, for example …