What this small topic covers
Three tools sit here, and each answers a question about whole numbers. The Factorial calculator multiplies a positive integer by every smaller positive integer, the GCD calculator finds the largest integer that divides two given integers evenly, and the LCM calculator finds the smallest positive integer that both integers divide into. They are the working tools behind counting problems, fraction simplification, scheduling and basic number theory, and they are also frequent classroom checks where students want to confirm hand arithmetic. The tasks look unrelated at first, yet GCD and LCM are tied by a clean identity, and factorials supply the counts that appear in arrangements and probability. This page explains which question calls for which tool, how big the answers can get, and where input mistakes tend to happen with integers.
Factorials and how quickly they grow
The factorial of n, written n!, is the product 1 × 2 × 3 × ... × n, and by convention 0! equals 1. So 5! is 120 and 10! is 3,628,800. It counts the ways to arrange n distinct objects in a row, which is why 5 people can queue in 120 different orders. Growth is extreme: 20! is 2,432,902,008,176,640,000, within a factor of four of the largest integer a 64-bit signed integer can hold, and 25! has 26 digits. Ordinary floating-point numbers lose exactness at this size, but the Factorial calculator returns the exact integer, accepting n from 0 to 1,000. Factorials are defined only for nonnegative integers in this setting, and an input such as 5.5 or -3 does not have a standard ordinary factorial. The gamma function extends the idea to non-integers, but that is a separate function.
Greatest common divisor
The GCD of two integers is the largest integer that divides each of them with no remainder. The GCD of 84 and 36 is 12. The standard method is the Euclidean algorithm, which replaces the pair by the smaller number and the remainder of dividing the larger by the smaller, until the remainder reaches zero: 84 mod 36 is 12, then 36 mod 12 is 0, so the answer is 12. Its main everyday use is simplifying fractions, since 84/36 reduces to 7/3 after dividing both by 12. It also tells you the largest square tile that fits a rectangle exactly, or the largest number of identical groups that can be made from two different counts without leftovers.
Least common multiple
The LCM of two integers is the smallest positive integer that each of them divides evenly. The LCM of 4 and 6 is 12. It appears when events repeat on different cycles. If one bus leaves every 12 minutes and another every 18, they leave together every 36 minutes, since 36 is the LCM of 12 and 18. It is also the common denominator that makes adding fractions with different denominators tidy. For two numbers, the identity GCD(a, b) × LCM(a, b) = a × b holds, so LCM of 12 and 18 equals 12 × 18 divided by their GCD of 6, which is 36. That relation is a handy way to check results from the two tools against each other.
Choosing the right tool
Ask what you want to know. If the question is how many ways something can be ordered, use the factorial. If you need to split or simplify, with phrases like largest group size, reduce, or biggest equal pieces, that points to the GCD. If the question is when will things coincide, smallest common size or common denominator, that points to the LCM. A frequent confusion is swapping the two, which can be caught by a size check: the GCD can never exceed the smallest of the nonzero numbers, and the LCM is never smaller than the largest. If your answer violates either rule, you have probably used the wrong tool or mixed up the inputs.
Zero, negatives and one
Edge cases need care. The GCD of a number and 0 is the absolute value of that number, because every integer divides 0, so GCD(0, 9) is 9. The GCD of 0 and 0 is left undefined in some texts, and the GCD calculator uses 0 as its convention. Negative signs are ignored, so GCD(-12, 18) is 6. The LCM calculator returns 0 when either input is 0, since 0 is a multiple of every number, though many courses avoid the case. The number 1 behaves simply: the GCD of 1 and any integer is 1, and the LCM of 1 and n is n. If a result looks surprising for such inputs, check the conventions the page states rather than assuming a calculator mistake.
Mistakes with larger inputs
The LCM can grow much faster than the inputs. For two numbers that share no factors, it equals their product, so the LCM of 98 and 99 is 9,702, while 98 and 100 share the factor 2, which brings their LCM down to 4,900. The GCD and LCM calculators use exact integer arithmetic, so even very large inputs give exact results, but only two integers are accepted at a time. Typing a decimal where an integer is required, or including a thousands separator, are common causes of rejected input. For a list of three or more numbers, combine pairs step by step: take the LCM of the first two, then the LCM of that result with the third, and the same pattern works for the GCD.
Where these ideas show up
Cryptography relies heavily on the Euclidean algorithm and on large GCD computations, for example in finding modular inverses. Music and gear design use LCM to see when two cycles of different lengths realign, and gear teeth numbers with a GCD of 1 distribute wear evenly. Counting problems in probability use factorials to build permutations and combinations: the number of ways to choose 3 items from 10 is 10! divided by 3! and 7!, which is 120. Teachers lean on all three for fraction work, and exam questions often ask for the GCD and LCM of the same pair so the identity can be used as a check. Whenever you find yourself dividing or multiplying many integers to a pattern, check whether one of these three functions describes the structure, because that usually leads to a shorter and safer calculation.
Frequently asked questions
- Why is 0! equal to 1?
- It is a convention that keeps formulas for permutations and combinations consistent. There is exactly one way to arrange zero objects, the empty arrangement.
- What is the relationship between GCD and LCM?
- For two positive integers, GCD times LCM equals the product of the two numbers. This lets you compute one from the other.
- Can I find the GCD of decimals?
- These tools work with integers. Multiply decimals by a power of ten to make them whole numbers first, then take the GCD and adjust for the scaling.
- How large a factorial can the tool compute?
- The Factorial calculator accepts whole numbers from 0 to 1,000 and returns the exact integer, so every digit is reliable even though the result is far beyond ordinary floating-point numbers.