How this HCF calculator works
Enter two whole numbers. The calculator finds their highest common factor, the largest positive integer that divides both with no remainder. For 12 and 18 the result is 6.
The method is the Euclidean algorithm. Take absolute values first, so a minus sign never changes the answer. Then replace the pair with the smaller number and the remainder of the division, and keep going until the remainder is 0. The last non-zero remainder is the HCF.
Worked example: 48 and 18. 48 divided by 18 is 2 with remainder 12. 18 divided by 12 is 1 with remainder 6. 12 divided by 6 is 2 with remainder 0. The HCF is 6. The same 6 appears for 12 and 18, and swapping the two boxes still gives 6. −12 and 18 also give 6, because the signs are removed before the division starts.
An HCF of 1 means the numbers share no divisor larger than 1. 8 and 15 give 1. A number paired with itself returns that number’s absolute value, so 17 and 17 give 17. If one number is 0 and the other is not, the result is the absolute value of the other: 0 and 5 give 5. Both zeros give 0, because there is no remainder to compute. Decimals are rejected. Both boxes must hold whole numbers, or the result stays --. This page finds the HCF of two integers. It does not print the LCM.