Finding the Greatest Common Divisor of Two Numbers by Factoring

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

You can find the greatest common divisor (GCD) of two numbers by multiplying together all the prime factors they have in common.

Contributed by: Jesse Nochella (March 2011)
Open content licensed under CC BY-NC-SA



A much more efficient way of computing GCDs has been known for the past 2300 years. Named the Euclidean Algorithm, it is one of the oldest mathematical procedures known, appearing in Euclid's Elements around 300 BC.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.