Advertisement

Common factor calculator

See all positive divisors shared by two integers. The quotient columns show how each candidate divides both original values exactly.

Calculator

Greatest common factor
6.00000000
Number of positive common factors
4.00000000
All positive common factors
FactorFirst integer / factorSecond integer / factor
1.0000000012.0000000018.00000000
2.000000006.000000009.00000000
3.000000004.000000006.00000000
6.000000002.000000003.00000000

Advertisement

How this calculator works

First find the greatest common factor with the Euclidean algorithm. Every common factor must divide that greatest factor, and every positive divisor of it divides both inputs. Searching divisor pairs up to its square root finds the full list without scanning every integer to the larger input. Values are limited to a magnitude of one trillion to keep this exhaustive search responsive.

Formula

Common positive factors of a and b = positive divisors of gcd(|a|,|b|). Each listed f satisfies a/f and b/f both integers.

Worked example

For 12 and 18, the greatest common factor is 6. Its positive divisors are 1, 2, 3 and 6; dividing the original inputs by 3 gives 4 and 6. For 8 and 15 the only positive common factor is 1.

Advertisement

Frequently asked questions

Does this list just the greatest factor?

It lists all positive common factors as well as the greatest one. The quotient columns provide a check for each result.

How are negative integers handled?

Signs do not change the positive factor list. Quotients retain the signs of the original inputs.

Can one number be zero?

Yes. Every positive integer divides zero, so the common factors are exactly the positive divisors of the other input. Two zeros are rejected because that list is infinite.

Sources

Advertisement