Greatest Common Divisor
This JavaScript program calculates the greatest common divisor (GCD) of the given integers.
The program
Instructions
In the input text field, enter the number whose divisors will be listed, then press the Calculate GCD
button. The numbers must be between −253 and 253, inclusive.
Examples:
- gcd(0, 2) = 2
- gcd(3, 5) = 1
- gcd(24, 18) = 6
Links
- Wikipedia: Greatest common divisor
- Wikipedia: Euclidean algorithm
- MathWorld: Greatest Common Divisor
Last modified: 2008-04-16-Wed
Created: 2007-09-03-Mon