Number & Arithmetic Calculators: GCD, LCM, Factorials, Logarithms & More
Number theory and basic arithmetic operations are the foundation of mathematics, engineering, computer science, and everyday problem-solving. Whether you need to simplify a fraction, find the lowest common denominator, check if a large number is prime, or compute a factorial for a combinatorics problem, having the right calculator at hand saves time and reduces errors.
Greatest Common Divisor (GCD)
The GCD of two or more integers is the largest positive integer that divides each of them without a remainder. It is used to simplify fractions and solve Diophantine equations.
Euclidean Algorithm: GCD(a, b) = GCD(b, a mod b), repeated until the remainder is 0. Example: GCD(48, 18) → GCD(18, 12) → GCD(12, 6) → GCD(6, 0) = 6.
Use the GCD Calculator for multi-number GCDs in one step.
Least Common Multiple (LCM)
The LCM is the smallest positive integer that is divisible by each of the given integers. It is essential for adding fractions with different denominators.
Formula: LCM(a, b) = |a × b| ÷ GCD(a, b)
Example: LCM(4, 6) = (4 × 6) ÷ GCD(4, 6) = 24 ÷ 2 = 12. The LCM Calculator extends this to lists of numbers.
Prime Numbers
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. To test primality for moderate numbers, trial division up to the square root of n suffices: if no integer from 2 to √n divides n, then n is prime. The Prime Number Checker applies efficient algorithms to test even very large numbers.
Factorials
The factorial of a non-negative integer n (written n!) is the product of all positive integers from 1 to n:
n! = n × (n−1) × (n−2) × … × 2 × 1, with 0! = 1 by convention.
| n | n! |
|---|---|
| 0 | 1 |
| 5 | 120 |
| 10 | 3,628,800 |
| 20 | 2,432,902,008,176,640,000 |
Factorials grow extraordinarily fast. They appear in permutations, combinations, and Taylor series. The Factorial Calculator handles large n values that exceed standard calculator limits.
Powers, Roots, and Logarithms
These three operations are inverses of one another:
- Power: bn = b × b × … × b (n times). Use the Power Calculator.
- Nth Root: The nth root of x is x1/n. The Nth Root Calculator handles any real root, including cube roots, fourth roots, and beyond.
- Logarithm: logb(x) = n means bn = x. The natural logarithm (ln) uses base e ≈ 2.71828; the common logarithm (log) uses base 10. The Logarithm Calculator supports any base.
Key identities: log(a × b) = log(a) + log(b); log(an) = n × log(a); ln(ex) = x.
Modulo Operation
The modulo operation returns the remainder after integer division: a mod m = r, where a = q × m + r and 0 ≤ r < m.
Examples: 17 mod 5 = 2 (because 17 = 3 × 5 + 2); 100 mod 7 = 2 (100 = 14 × 7 + 2).
Modulo is foundational in cryptography, clock arithmetic, hash functions, and programming. Negative number behaviour differs across programming languages — the Modulo Calculator clarifies the result for any inputs.
Summing and Rounding
The Sum Calculator adds a list of numbers quickly, supporting comma-separated or line-separated input — ideal for totalling survey data or adding up a list of expenses. The Rounding Calculator rounds any decimal to a specified number of decimal places or significant figures, applying standard half-up rounding (where 0.5 rounds away from zero).
Common Mistakes
- Confusing GCD and LCM. GCD makes numbers smaller (simplifying fractions); LCM makes them larger (finding common denominators). A mnemonic: Greatest = smaller result, Least = larger result.
- Forgetting 1 is not prime. By definition, 1 is neither prime nor composite. This matters in proofs and factorisation.
- Mixing log and ln. In mathematics, "log" often means natural log; in engineering it usually means log base 10. Always check context.
- Overflow in factorial calculations. 21! already exceeds the limit of a 64-bit integer. Use the dedicated Factorial Calculator for large values.
- Rounding too many intermediate steps. Round only the final answer; intermediate rounding accumulates error, especially in division chains.
Frequently Asked Questions
What is the difference between GCD and HCF?
They are the same thing — Greatest Common Divisor and Highest Common Factor are two names for the largest integer that divides a set of numbers exactly.
Can the LCM of two numbers be smaller than either number?
No. The LCM is always at least as large as the largest of the input numbers. It equals the larger number when one number is a multiple of the other.
Why is log base e natural?
The natural logarithm arises naturally in calculus because the derivative of ln(x) is simply 1/x, making it the most analytically convenient logarithm for differentiation and integration.
What does modulo have to do with clocks?
Clock arithmetic is modulo 12 (or 24). If it is 10:00 and you add 5 hours, you get (10 + 5) mod 12 = 3:00. This is also called "clock arithmetic" or cyclic group arithmetic in mathematics.