GCF Calculator
Find the greatest common factor of two, three or fifty numbers, or of monomials and polynomials with variables and exponents, with every step shown. This greatest common factor calculator also factors out the GCF, gives the LCM, and checks each answer.
⚡ 0. Quick Answer
A GCF calculator finds the greatest common factor: the largest whole number that divides every number in a set with no remainder.
For 24 and 36, write the primes: 24 = 2³ × 3 and 36 = 2² × 3². Keep the shared primes at their lowest power: 2² × 3 = 12. So GCF(24, 36) = 12 and LCM(24, 36) = 72.
Rule of thumb: the GCF is never bigger than the smallest number. If the GCF is 1, the numbers are relatively prime and a fraction made from them is already in lowest terms.
Key Takeaways
- This GCF calculator gives the greatest common factor of up to 50 numbers or 30 algebra terms, with every step.
- For numbers, keep the primes shared by every number at their lowest power: GCF(24, 36) = 2² × 3 = 12.
- For monomials, multiply the GCF of the coefficients by each shared letter at its lowest exponent: GCF(12x³y², 18x²y, 30xy⁴) = 6xy.
- To factor out the GCF, divide every term by it and keep a 1 where a whole term cancels: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1).
- For two numbers GCF × LCM = a × b, so 12 × 72 = 24 × 36 = 864. A GCF of 1 means the numbers are coprime.
📚 1. What Is a GCF Calculator?
The greatest common factor (GCF) of two or more whole numbers is the largest number that divides each of them exactly. It is also called the greatest common divisor (GCD) or the highest common factor (HCF). All three names mean the same thing.
A GCF calculator does this work for you and shows it. You type numbers such as 24, 36, or algebra terms such as 12x³y² + 18x²y − 30xy⁴, and it returns the exact GCF, the steps by four methods, the LCM, and a check that the answer is right.
What it is used for: simplifying fractions (24/36 = 2/3 after dividing by 12), splitting things into the largest equal groups, finding the biggest square tile for a floor, and the first step of factoring any polynomial.
A worked one-liner: GCF(24, 36): 36 = 1 × 24 + 12, then 24 = 2 × 12 + 0. The last non-zero remainder is 12.
Who uses it: students in Grades 4 to 9 meet the GCF with whole numbers, Grades 8 to 10 (Algebra 1, CBSE Class 10, IGCSE) use it to factor polynomials, teachers build answer keys with the batch tab, and programmers use Euclid's algorithm for fractions, ratios, screen aspect ratios and cryptography.
| Method | How it works | Best for | Weak spot |
|---|---|---|---|
| Listing factors | Write every factor of each number, pick the largest shared one | Small numbers under 100 | Slow and easy to miss a factor |
| Prime factorization | Shared primes at their lowest power | Two or three numbers; also gives the LCM | Hard when a number has a large prime factor |
| Euclid's algorithm | Divide, keep the remainder, repeat until 0 | Large numbers, computers, any size | Does not show the prime structure |
| Ladder (cake) method | Divide all numbers by a shared prime, repeat | Classroom work with 2 to 4 numbers | Needs a shared prime at each step |
| Monomial rule | GCF of coefficients times shared letters at lowest power | Algebra terms with variables and exponents | Whole-number coefficients only |
🧮 2. Enter Your Numbers or Algebra Terms
Two to fifty whole numbers. Negatives and 0 are allowed (GCF uses absolute values). A fraction such as 24/36 is read as the two numbers 24 and 36, so you can simplify it. Numbers up to 200 digits are exact.
Type powers with ^ (x^3), or paste x² and x³. 4ab means 4 × a × b. Use whole-number coefficients and single letters. Example list: 12x^3y^2, 18x^2y, 30xy^4. Example polynomial: 6x^2 + 9x.
Teachers use this to build an answer key: paste up to 200 problems, press Solve, then Download Doc saves every answer with its working.
Nothing is calculated until you press Solve (or Enter). Changing the sample clears the results.
📊 3. Results and Step-by-Step Solution
🧠 4. Understanding Your Answer, In Detail
4.1 What the GCF means
The GCF is the biggest number that "goes into" every number with nothing left over. If the GCF of 24 and 36 is 12, you can split 24 apples and 36 oranges into 12 identical bags, each with 2 apples and 3 oranges. No bigger number of identical bags is possible.
4.2 Why the quotients prove the answer
Divide each number by the GCF. For 24 and 36 you get 2 and 3. Those quotients share no factor except 1. If they shared a factor, say 2, then 2 × 12 = 24 would be a bigger common factor. This is the check the calculator runs on every answer.
4.3 A GCF of 1
When the GCF is 1, the numbers are relatively prime (coprime). They can both be composite: 35 = 5 × 7 and 64 = 2⁶ share no prime, so GCF(35, 64) = 1. A fraction such as 35/64 is already in lowest terms.
4.4 When the GCF equals one of the numbers
If the smallest number divides all the others, it is the GCF. GCF(12, 36, 60) = 12 because 36 and 60 are multiples of 12. Check this first; it saves time in exams.
4.5 The GCF of algebra terms
A monomial GCF has a number part and a letter part. The number part is the GCF of the coefficients. The letter part takes only letters found in every term, each at its lowest power. For 12x³y², 18x²y and 30xy⁴ the GCF is 6xy: 6 from the numbers, x¹ because the lowest power of x is 1, and y¹ because the lowest power of y is 1.
4.6 Negative signs
The GCF of numbers is always positive. In algebra, when the first term is negative, teachers usually want you to factor out the negative of the GCF so the bracket starts with a positive term: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1). The positive form 4ab(−2a² + 3ab − 1) is also correct.
4.7 How the GCF changes when one number changes
The GCF is very sensitive. GCF(24, 36) = 12, but GCF(24, 35) = 1 and GCF(24, 48) = 24. Changing one number by 1 can drop the GCF to 1, because consecutive numbers are always coprime.
4.8 What comes next
The GCF leads straight to the LCM (used to add fractions), to simplifying fractions and ratios, and to factoring polynomials by grouping, where you factor out a GCF from each pair of terms. Try the factor calculator to list every factor of one number, or the algebra calculator for the next step in factoring.
✍ 5. How to Write the Answer
▶ Solve a problem above to fill all five cards with your own answer.
📌 Conventions
- Show the prime factorization or the Euclid lines; a bare answer often scores 1 mark out of 3.
- Box or underline the final answer.
- Write GCF(a, b) = n, not just n.
📌 Conventions
- The GCF of numbers is a positive whole number, never a decimal.
- For factoring, write the GCF outside the brackets.
📌 Conventions
- Prime form in brackets helps students find their own error.
- Use the Batch tab to make a whole key at once.
📌 Conventions
- Name the method used (prime factorization or Euclid's algorithm).
- Spell out "greatest common factor" the first time, then use GCF.
📌 Conventions
- Use ^ for powers (x^3) so it pastes cleanly anywhere.
- Keep a space around + and - between terms.
∑ 6. Formulas Used
🔀 7. GCF Flowchart, Step by Step
This GCF flowchart shows how to find the greatest common factor step by step, from two raw numbers to a checked answer. Every box uses the same worked example as Sections 0, 9, 10, 11 and 14: 24 and 36.
Check any box yourself: =GCD(24,36) in Excel (Section 9), the R script in Section 10 and the Python script in Section 11 all return 12, and the by-hand method in Section 14 gets there with pencil and paper.
📝 8. How to Use This Calculator
- Pick a tab. Use Numbers for whole numbers, Monomials and Polynomials for algebra terms, or Batch for many problems at once.
- Type your problem. Separate numbers with commas, for example 24, 36. For algebra type 12x^3y^2 + 18x^2y - 30xy^4, or a comma list of monomials.
- Or load a sample problem. The Sample menu has 10 problems, from a textbook pair to a 19-digit pair, coprime numbers, 0 and 0, and a negative polynomial trap.
- Choose the methods to show. All methods shows prime factorization, Euclid, the ladder method and listing factors. Pick one if your teacher wants a specific method.
- Set the sign rule for algebra. Factor out a negative GCF when the first term is negative (the usual school form), or keep the GCF positive.
- Press Solve. Or press Enter. Nothing is computed before you do, so you never read an old answer.
- Read the answer box. It shows the exact GCF, the LCM, the GCF in prime form and a green Verified badge once the check passes.
- Follow the steps. Each step names its rule. Press Show key steps only for a short version you can copy into an exam answer.
- Look at the tables and charts. The Venn diagram, ladder table, Euclid table and four charts show why the GCF is what it is.
- Copy or download your working. Section 5 gives five ready answers to copy. Download Doc saves every step as text, and Download PDF prints the page.
📈 9. How to Find the GCF in Excel
Excel has a built-in GCD function, which is the same thing as the GCF. It takes up to 255 numbers or ranges, so one formula handles two, three or a whole column. Excel cannot factor algebra, but with three helper columns it finds the GCF of monomials too.
=GCD(A2:A3). Excel returns 12. =LCM(A2:A3) returns 72.9.1 The functions you need
| You want | Excel function | Note |
|---|---|---|
| GCF of numbers | =GCD(A2:A10) | Same as GCF and HCF; up to 255 arguments |
| LCM of numbers | =LCM(A2:A10) | Returns #NUM! if any value is negative |
| Remainder (Euclid step) | =MOD(A2,B2) | The a mod b in Euclid's algorithm |
| Whole-number quotient | =QUOTIENT(A2,B2) | Drops the remainder |
| Absolute value | =ABS(A2) | Wrap negatives before GCD |
| Lowest exponent | =MIN(B2:B4) | For the letter part of a monomial GCF |
| Simplified fraction | =A2/GCD(A2,B2)&"/"&B2/GCD(A2,B2) | Shows 2/3 for 24/36 |
9.2 Step by step
1 Put the numbers in one column
Type a header in A1 and the numbers below it. Here 24 is in A2 and 36 in A3.
Column A holds 24 and 36, the worked example used on the whole page.
2 Type the GCD and LCM formulas
In B2 type =GCD(A2:A3) and in C2 type =LCM(A2:A3).
Excel returns GCF = 12 and LCM = 72, the same as Sections 0 and 7.
3 Check the answer
In B2 type =A2/GCD($A$2:$A$3) and in C2 type =MOD(A2,GCD($A$2:$A$3)), then fill both down to row 3. In B4, =GCD(B2:B3) must give 1.
The quotients 2 and 3 have GCF 1 and both remainders are 0, so 12 is verified.
4 Show Euclid's algorithm (optional)
Put 36 in A2 and 24 in B2. In C2 type =MOD(A2,B2). In A3 type =B2, in B3 type =C2, and fill row 3 down until the remainder is 0.
The remainders go 12 then 0, so the GCF is the last divisor, 12. Teachers like this sheet because it shows the method.
5 GCF of monomials
Put each coefficient in column A and each power of x and y in columns B and C. Then =GCD(ABS(A2),ABS(A3),ABS(A4)), =MIN(B2:B4) and =MIN(C2:C4).
Row 5 reads 6, 1, 1, so the GCF of 12x³y², 18x²y and −30xy⁴ is 6xy. A letter with a 0 anywhere in its column is not in the GCF.
9.3 The awkward cases
- Negative numbers:
=GCD(-18,27)returns#NUM!. Use=GCD(ABS(A2),ABS(A3)), or in Excel 365=GCD(ABS(A2:A10)). - Decimals: Excel quietly truncates them, so
=GCD(2.9, 6)is treated as GCD(2, 6) = 2. Convert to whole numbers first. - Very large numbers: Excel stores 15 significant digits and GCD rejects values of 253 or more with
#NUM!. Sample 5 in the calculator (19 digits, GCF 987,654,321) cannot be done in Excel; use this page, R withgmp, or Python. - Zeros:
=GCD(0,36)gives 36, which is correct.=GCD(0,0)gives 0, but mathematically it is undefined.
9.4 Why Excel might disagree with R or Python
| Situation | What happens | Fix |
|---|---|---|
| A negative input | Excel: #NUM!. Python math.gcd(-18, 27) = 9 | Wrap with ABS in Excel |
| GCF(0, 0) | Excel and Python return 0; mathematics says undefined | Treat 0 as "no answer" |
| Numbers above 253 | Excel: #NUM! or lost digits. Python integers are exact at any size | Use Python, R gmp, or this calculator |
| Decimal inputs | Excel truncates; Python math.gcd(2.5, 5) raises TypeError | Scale to whole numbers first |
-3^2 typed in a cell | Excel gives 9 because the minus binds first; R, Python and paper give −9 | Write =-(3^2). Matters when you square a coefficient |
| Base R | Has no built-in gcd function at all | Use the 6-line Euclid function in Section 10 |
9.5 Charting it in Excel
Select the prime column and the exponent columns for each number, then Insert, Clustered Column chart. Add a GCF column with =MIN(B2:C2) and colour it green, so the shared lowest powers stand out. Two fixes: set the vertical axis Major unit to 1 (exponents are whole numbers), and put primes on the horizontal axis as text, not numbers.
9.6 Excel errors you will probably hit
| Error | Cause | Fix |
|---|---|---|
#NUM! | A negative value, or a value of 253 or more | ABS(), or switch tools for huge numbers |
#VALUE! | Text in the range, such as "24 cm" | Keep only numbers in the cells |
#NAME? | Typed GCF( instead of GCD( | The Excel name is GCD |
#DIV/0! | Dividing by a GCD that came out 0 (all cells empty or 0) | Check the range has a non-zero number |
#SPILL! | A dynamic-array formula has no room to spill | Clear the cells below it |
📈 10. How to Find the GCF in R
Base R has no gcd() function, which surprises many students. The script below writes Euclid's algorithm in six lines, folds it over a list with Reduce, prints the prime factors, the Euclid table and the check, finds the GCF of the monomials 12x³y², 18x²y and −30xy⁴, and saves one 300 dpi figure.
Rscript gcf.R. Change only the x <- c(24, 36) line.numbers::GCD(), pracma::gcd(), gmp::gcd.bigz() for huge numbers10.1 The complete script
R, base only, saves gcf_plot.png
# ============================================================
# GCF calculator in R: numbers and monomials, with a 300 dpi plot
# StatsUnlock - https://statsunlock.com/gcf-calculator/
# Base R only. No packages to install.
# ============================================================
# ---- 1. Your numbers (change this line) --------------------
x <- c(24, 36)
# ---- 2. Euclid's algorithm for two numbers ------------------
gcd2 <- function(a, b) {
a <- abs(a); b <- abs(b)
while (b != 0) {
r <- a %% b # remainder
a <- b
b <- r
}
a
}
gcf_all <- function(v) Reduce(gcd2, v) # fold over the list
lcm2 <- function(a, b) abs(a * b) / gcd2(a, b)
lcm_all <- function(v) Reduce(lcm2, v)
# ---- 3. Prime factorization (trial division) --------------
prime_factors <- function(n) {
n <- abs(n); f <- c(); d <- 2
while (n > 1) {
while (n %% d == 0) { f <- c(f, d); n <- n / d }
d <- d + 1
if (d * d > n && n > 1) { f <- c(f, n); break }
}
f
}
g <- gcf_all(x)
l <- lcm_all(x)
cat("Numbers:", paste(x, collapse = ", "), "\n")
for (v in x) cat(v, "=", paste(prime_factors(v), collapse = " x "), "\n")
cat("GCF =", g, "\n")
cat("LCM =", l, "\n")
# ---- 4. Euclid table for the first two numbers ------------
a <- max(abs(x[1:2])); b <- min(abs(x[1:2]))
while (b != 0) {
cat(sprintf("%g = %g x %g + %g\n", a, a %/% b, b, a %% b))
r <- a %% b; a <- b; b <- r
}
# ---- 5. Check: GCF divides every number, quotients coprime -
q <- x / g
ok <- all(x %% g == 0) && gcf_all(q) == 1
cat("Quotients:", paste(q, collapse = ", "), "| check passed:", ok, "\n")
if (g == 1) cat("Verdict: the numbers are relatively prime.\n") else
cat("Verdict: the greatest common factor is", g, "\n")
# ---- 6. GCF of monomials: 12x^3y^2, 18x^2y, 30xy^4 --------
coef <- c(12, 18, -30)
px <- c(3, 2, 1) # powers of x in each term
py <- c(2, 1, 4) # powers of y in each term
gc <- gcf_all(abs(coef))
cat(sprintf("Monomial GCF = %gx^%gy^%g (6xy)\n", gc, min(px), min(py)))
cat("Bracket coefficients:", paste(coef / gc, collapse = ", "),
"| x powers:", paste(px - min(px), collapse = ", "),
"| y powers:", paste(py - min(py), collapse = ", "), "\n")
cat("Factored: 6xy(2x^2y + 3x - 5y^3)\n")
# ---- 7. One 300 dpi figure: prime exponents ----------------
primes <- sort(unique(unlist(lapply(x, prime_factors))))
ex <- sapply(x, function(v) sapply(primes, function(p) sum(prime_factors(v) == p)))
ex <- matrix(ex, nrow = length(primes))
ex <- cbind(ex, apply(ex, 1, min))
png("gcf_plot.png", width = 1800, height = 1200, res = 300)
barplot(t(ex), beside = TRUE, names.arg = primes,
col = c("#2563eb", "#ea580c", "#16a34a")[seq_len(ncol(ex))],
legend.text = c(paste("Number", x), "GCF (lowest)"),
xlab = "Prime", ylab = "Exponent",
main = paste0("GCF(", paste(x, collapse = ", "), ") = ", g))
invisible(dev.off())
cat("Saved gcf_plot.png\n")
Output: 24 = 2 x 2 x 2 x 3, 36 = 2 x 2 x 3 x 3, GCF = 12, LCM = 72, Euclid lines 36 = 1 x 24 + 12 and 24 = 2 x 12 + 0, check passed: TRUE, and the monomial GCF 6xy with 6xy(2x^2y + 3x - 5y^3).
10.2 What each part does
| Part | What it does |
|---|---|
a %% b | The remainder. In R, %% takes the sign of the divisor, so the script uses abs() first |
Reduce(gcd2, v) | Applies GCF(GCF(a, b), c) across any length of list |
lcm2 | Uses LCM = |a × b| ÷ GCF |
prime_factors() | Trial division; fine for numbers up to about 1012 |
a %/% b | Integer division, the quotient in each Euclid line |
png(..., res = 300) | Opens a 300 dpi file; dev.off() writes it |
10.3 What the figure shows
A grouped bar chart with one bar per number for each prime, and a green bar for the lowest exponent. For 24 and 36 the green bars are 2 for the prime 2 and 1 for the prime 3, so GCF = 2² × 3 = 12.
10.4 Common R problems and fixes
| Problem | Fix |
|---|---|
could not find function "gcd" | Base R has none. Use the function above or numbers::GCD |
| Wrong answer above about 9 × 1015 | Doubles lose whole-number precision past 253. Use library(gmp); gcd.bigz(as.bigz("1219326312114007011"), as.bigz("1085200427667885993")) |
| Negative remainder surprises | -7 %% 3 is 2 in R; take abs() first |
| Plot window blank in Rscript | Rscript writes to the PNG file only; open gcf_plot.png |
Reduce on an empty vector returns NULL | Check length(x) > 0 first |
| Decimals give odd answers | %% works on doubles; scale to whole numbers first |
10.5 Useful one-liners
Reduce(function(a, b) if (b == 0) a else Recall(b, a %% b), c(48, 72, 120))gives 24.numbers::GCD(24, 36)andnumbers::LCM(24, 36)give 12 and 72.pracma::gcd(24, 36)also returns 12.MASS::fractions(24/36)prints 2/3.gmp::factorize(1219326312114007011)gives the prime factors of a 19-digit number exactly.
📈 11. How to Find the GCF in Python
Python makes the GCF easy: math.gcd works on integers of any size, and from Python 3.9 it takes any number of arguments. For algebra, SymPy's factor_terms factors out the GCF of a polynomial exactly. The script prints the same numbers as every other section and saves one 300 dpi figure.
nums = [24, 36] line and, for algebra, the poly = ... line.pip install sympy matplotlib
11.1 The complete script
Python 3.9+, saves gcf_plot_py.png
# ============================================================
# GCF calculator in Python: numbers and polynomials, 300 dpi plot
# StatsUnlock - https://statsunlock.com/gcf-calculator/
# pip install sympy matplotlib
# ============================================================
import math
from functools import reduce
from sympy import factorint, symbols, factor_terms, gcd, expand
import matplotlib
matplotlib.use("Agg") # remove this line in Jupyter to see the plot
import matplotlib.pyplot as plt
# ---- 1. Your numbers (change this line) --------------------
nums = [24, 36]
# ---- 2. GCF and LCM ----------------------------------------
g = math.gcd(*nums) # Python 3.9+ takes any number of values
l = math.lcm(*nums) # Python 3.9+
print("Numbers:", nums)
for n in nums:
print(n, "=", " x ".join(f"{p}^{e}" if e > 1 else str(p) for p, e in factorint(n).items()))
print("GCF =", g)
print("LCM =", l)
# ---- 3. Euclid table, written out ---------------------------
a, b = max(nums[:2]), min(nums[:2])
while b:
print(f"{a} = {a // b} x {b} + {a % b}")
a, b = b, a % b
# ---- 4. Check: GCF divides every number, quotients coprime -
quot = [n // g for n in nums]
ok = all(n % g == 0 for n in nums) and math.gcd(*quot) == 1
print("Quotients:", quot, "| check passed:", ok)
print("Verdict:", "relatively prime" if g == 1 else f"the greatest common factor is {g}")
# ---- 5. Factor out the GCF of a polynomial -----------------
x, y = symbols("x y")
poly = 12*x**3*y**2 + 18*x**2*y - 30*x*y**4
G = gcd(gcd(12*x**3*y**2, 18*x**2*y), 30*x*y**4) # GCF of the monomials
factored = factor_terms(poly)
print("Monomial GCF =", G)
print("Factored form:", factored)
print("Check expands back:", expand(factored) == expand(poly))
# ---- 6. One 300 dpi figure: prime exponents -----------------
primes = sorted(set().union(*[factorint(n).keys() for n in nums]))
fig, ax = plt.subplots(figsize=(6, 4))
w = 0.8 / (len(nums) + 1)
colors = ["#2563eb", "#ea580c", "#0d9488", "#9333ea"]
for i, n in enumerate(nums):
ex = [factorint(n).get(p, 0) for p in primes]
ax.bar([k + i * w for k in range(len(primes))], ex, w, label=str(n), color=colors[i % 4])
low = [min(factorint(n).get(p, 0) for n in nums) for p in primes]
ax.bar([k + len(nums) * w for k in range(len(primes))], low, w, label="GCF (lowest)", color="#16a34a")
ax.set_xticks([k + w * len(nums) / 2 for k in range(len(primes))], [str(p) for p in primes])
ax.set_xlabel("Prime"); ax.set_ylabel("Exponent")
ax.set_title(f"GCF({', '.join(map(str, nums))}) = {g}")
ax.legend()
fig.savefig("gcf_plot_py.png", dpi=300, bbox_inches="tight")
print("Saved gcf_plot_py.png")
Output: GCF = 12, LCM = 72, the two Euclid lines, check passed: True, Monomial GCF = 6*x*y and Factored form: 6*x*y*(2*x**2*y + 3*x - 5*y**3).
11.2 What each part does
| Part | What it does |
|---|---|
math.gcd(*nums) | GCF of the whole list; exact for integers of any length |
math.lcm(*nums) | LCM (Python 3.9 or later) |
factorint(n) | SymPy prime factorization as a dictionary {{prime: power}} |
a // b, a % b | Quotient and remainder for each Euclid line |
gcd(m1, m2) | SymPy GCF of two monomials, here 6*x*y |
factor_terms(poly) | Factors out the GCF of every term |
Python traps: ^ is XOR, not a power, so x^2 is wrong; write x**2. math.gcd(-18, 27) returns 9 (positive). math.gcd(2.5, 5) raises a TypeError. SymPy keeps the GCF positive, so it writes −8a³b + 12a²b² − 4ab as 4ab(−2a² + 3ab − 1); the calculator's default is the equivalent −4ab(2a² − 3ab + 1).
11.3 What the figure shows
The same grouped bar chart as R: blue and orange bars for the exponents of 24 and 36, and green for the lowest shared power. The title reads GCF(24, 36) = 12.
11.4 Common Python problems and fixes
| Problem | Fix |
|---|---|
TypeError: gcd() takes exactly 2 arguments | You are on Python 3.8 or older. Use functools.reduce(math.gcd, nums) |
AttributeError: module 'math' has no attribute 'lcm' | Python 3.8 or older. Use a*b // math.gcd(a, b) |
numpy.gcd gives a wrong big answer | NumPy uses 64-bit integers; use math.gcd for huge values |
| SymPy returns a positive GCF | Multiply by −1 yourself if your teacher wants a negative GCF |
| No plot appears | Remove matplotlib.use("Agg") in Jupyter, or open the PNG |
11.5 Useful one-liners
math.gcd(48, 72, 120)gives 24.math.gcd(1219326312114007011, 1085200427667885993)gives 987654321, exactly.from fractions import Fraction; Fraction(24, 36)gives Fraction(2, 3).sympy.factor_terms(6*x**2 + 9*x)gives 3*x*(2*x + 3).sympy.gcd_list([12, 18, 30])gives 6.
Run it from a terminal with python gcf.py, in Jupyter (add plt.show()), or paste it into Google Colab, where SymPy and Matplotlib are already installed.
📋 12. Reference Tables
12.1 GCF of common number pairs
How to use: find the pair, read the GCF, then divide both numbers by it to simplify a fraction.
| Pair | GCF | LCM | Pair | GCF | LCM |
|---|---|---|---|---|---|
| 4 and 6 | 2 | 12 | 18 and 24 | 6 | 72 |
| 6 and 9 | 3 | 18 | 24 and 36 | 12 | 72 |
| 8 and 12 | 4 | 24 | 28 and 42 | 14 | 84 |
| 12 and 18 | 6 | 36 | 36 and 48 | 12 | 144 |
| 15 and 20 | 5 | 60 | 45 and 60 | 15 | 180 |
| 16 and 24 | 8 | 48 | 48 and 72 | 24 | 144 |
| 12 and 16 | 4 | 48 | 54 and 36 | 18 | 108 |
| 10 and 15 | 5 | 30 | 32 and 48 | 16 | 96 |
12.2 Divisibility rules (to find shared primes fast)
| Divisor | Rule | Example |
|---|---|---|
| 2 | Last digit is even | 36 → 6 is even |
| 3 | Digit sum divisible by 3 | 24 → 2 + 4 = 6 |
| 4 | Last two digits divisible by 4 | 136 → 36 ÷ 4 = 9 |
| 5 | Last digit 0 or 5 | 75 |
| 6 | Divisible by 2 and by 3 | 84 |
| 7 | Double the last digit, subtract from the rest; result divisible by 7 | 126 → 12 − 12 = 0 |
| 8 | Last three digits divisible by 8 | 1,024 → 024 ÷ 8 = 3 |
| 9 | Digit sum divisible by 9 | 126 → 9 |
| 10 | Last digit 0 | 120 |
| 11 | Alternating digit sum divisible by 11 | 121 → 1 − 2 + 1 = 0 |
12.3 Prime numbers below 200
How to use: when factoring, try these in order. Stop once the prime squared is bigger than what is left.
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199
12.4 Prime factorizations of 2 to 60
| n | Primes | n | Primes | n | Primes |
|---|---|---|---|---|---|
| 12 | 2² × 3 | 30 | 2 × 3 × 5 | 45 | 3² × 5 |
| 16 | 2⁴ | 32 | 2⁵ | 48 | 2⁴ × 3 |
| 18 | 2 × 3² | 36 | 2² × 3² | 50 | 2 × 5² |
| 20 | 2² × 5 | 40 | 2³ × 5 | 54 | 2 × 3³ |
| 24 | 2³ × 3 | 42 | 2 × 3 × 7 | 56 | 2³ × 7 |
| 28 | 2² × 7 | 44 | 2² × 11 | 60 | 2² × 3 × 5 |
12.5 GCF vs LCM at a glance
| Question | GCF | LCM |
|---|---|---|
| Built from | Shared primes, lowest power | All primes, highest power |
| Size | ≤ smallest number | ≥ largest number |
| Used for | Simplifying fractions, equal groups, factoring | Adding fractions, schedules that line up |
| Coprime numbers | 1 | Their product |
| Word clue | "largest", "greatest", "split into", "biggest square" | "smallest", "next time together", "every" |
12.6 Algebra GCF patterns
| Expression | GCF | Factored form |
|---|---|---|
| 6x² + 9x | 3x | 3x(2x + 3) |
| 4a³ − 8a² | 4a² | 4a²(a − 2) |
| 10xy + 15y | 5y | 5y(2x + 3) |
| x³ + x² + x | x | x(x² + x + 1) |
| −2m² − 6m | −2m | −2m(m + 3) |
| 7p + 11q | 1 | Already prime (no common factor) |
📈 13. Example Results
Eight worked problems, from a textbook pair to a 19-digit pair and an algebra trap. Each one can be checked with the calculator above.
GCF of 12 and 18
The pair in almost every Grade 6 worksheet.
Find the greatest common factor of 12 and 18.
| Item | Value | Note |
|---|---|---|
| Shared primes | 2 and 3 | Both appear in 12 and 18 |
| Lowest powers | 2¹ and 3¹ | min(2, 1) and min(1, 2) |
| GCF | 6 | 2 × 3 |
| Check | 12 ÷ 6 = 2, 18 ÷ 6 = 3 | GCF(2, 3) = 1 |
What it means: Six is the largest number that divides both. 12/18 simplifies to 2/3.
How to write it: GCF(12, 18) = 6.
GCF of 48, 72 and 120
Three numbers are where the ladder method shines.
Find the GCF of 48, 72 and 120 and show your method.
| Item | Value | Note |
|---|---|---|
| Divide by 2 three times | 48, 72, 120 → 6, 9, 15 | 2 × 2 × 2 = 8 |
| Divide by 3 | 6, 9, 15 → 2, 3, 5 | No shared prime left |
| GCF | 24 | 2³ × 3 |
| LCM | 720 | 2⁴ × 3² × 5 |
What it means: 24 divides all three. The leftover numbers 2, 3 and 5 are coprime, which proves 24 is the greatest.
How to write it: GCF(48, 72, 120) = 24.
Cutting 45 cm and 75 cm ribbons
A craft teacher wants equal pieces with no waste.
Two ribbons are 45 cm and 75 cm long. Cut both into pieces of the same length, as long as possible, with nothing left over.
| Item | Value | Note |
|---|---|---|
| 45 | 3² × 5 | |
| 75 | 3 × 5² | |
| Longest piece | 15 cm | 3 × 5 |
| Total pieces | 8 | 3 + 5 |
What it means: Each piece is 15 cm. Any longer piece would leave waste on at least one ribbon.
How to write it: The longest equal piece is GCF(45, 75) = 15 cm, giving 3 + 5 = 8 pieces.
Simplify 84/126 in one step
Dividing by the GCF finishes the job at once.
Write 84/126 in lowest terms.
| Item | Value | Note |
|---|---|---|
| GCF | 42 | 2 × 3 × 7 |
| 84 ÷ 42 | 2 | New numerator |
| 126 ÷ 42 | 3 | New denominator |
| Decimal | 0.67 | To 2 decimal places |
What it means: Dividing by a smaller common factor such as 2 or 6 needs more steps. The GCF does it once.
How to write it: 84/126 = 2/3 (divided by GCF 42).
Coprime numbers: 35 and 64
Two composite numbers can still have GCF 1.
Find GCF(35, 64).
| Item | Value | Note |
|---|---|---|
| Shared primes | none | |
| GCF | 1 | Relatively prime |
| LCM | 2,240 | 35 × 64 |
| Euclid | 64 = 1 × 35 + 29 ... ends at 1 |
What it means: Neither number is prime, but they share no prime. 35/64 is already in lowest terms.
How to write it: GCF(35, 64) = 1, so 35 and 64 are coprime.
0 and 27, then 0 and 0
Zero behaves differently from every other number.
Find GCF(0, 27) and GCF(0, 0).
| Item | Value | Note |
|---|---|---|
| Factors of 27 | 1, 3, 9, 27 | All divide 0 too |
| GCF(0, 27) | 27 | The largest of them |
| GCF(0, 0) | undefined | No largest divisor exists |
| Software | returns 0 | A convention, not a real GCF |
What it means: GCF(0, n) = |n|. With all zeros there is no greatest common factor, and the calculator says so in fuchsia.
How to write it: GCF(0, 27) = 27; GCF(0, 0) is undefined.
Two 19-digit numbers
Too big for Excel, easy for Euclid.
Find GCF(1,219,326,312,114,007,011, 1,085,200,427,667,885,993).
| Item | Value | Note |
|---|---|---|
| Euclid steps | 15 | Each remainder is smaller |
| GCF | 987,654,321 | Last non-zero remainder |
| Quotients | 1,234,567,891 and 1,098,765,433 | Coprime |
| Excel | #NUM! | Over the 253 limit |
What it means: Euclid never needs prime factors, so size does not matter. Exact BigInt arithmetic keeps every digit.
How to write it: GCF = 987,654,321 by Euclid's algorithm (15 steps).
−8a³b + 12a²b² − 4ab
Two marks lost here every year.
Factor out the GCF, starting with a negative.
| Item | Value | Note |
|---|---|---|
| GCF of 8, 12, 4 | 4 | |
| Letters | a¹b¹ | Lowest powers |
| Wrong | −4ab(2a² − 3ab) | Dropped the 1 |
| Right | −4ab(2a² − 3ab + 1) | Multiplies back exactly |
What it means: −4ab ÷ −4ab = 1, not 0. Leaving out the 1 changes the expression.
How to write it: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1).
✏️ 14. How to Find the GCF by Hand, Step by Step
This is the pen and paper method a teacher expects to see, worked on the same example as Sections 0, 7, 9, 10 and 11: 24 and 36. Then the algebra version on 12x³y² + 18x²y − 30xy⁴.
14.1 The written method
- Write each number as a product of primes. Divide by 2 while you can, then 3, then 5. 24 = 2 × 2 × 2 × 3 and 36 = 2 × 2 × 3 × 3.
- Use index form. 24 = 2³ × 3 and 36 = 2² × 3².
- Circle the primes found in both. 2 and 3.
- Take the lowest power of each. 2² (not 2³) and 3¹ (not 3²).
- Multiply. 2² × 3 = 12.
- Check by division. 24 ÷ 12 = 2 and 36 ÷ 12 = 3. 2 and 3 share nothing, so 12 is the greatest.
- Or use Euclid for big numbers. 36 = 1 × 24 + 12, 24 = 2 × 12 + 0. The last divisor is 12.
- For algebra: GCF(12, 18, 30) = 6; lowest x power 1; lowest y power 1; GCF = 6xy. Divide: 2x²y, 3x, −5y³. Answer 6xy(2x²y + 3x − 5y³). Multiply back to check.
14.2 On a scientific calculator
| Calculator | Keys | What you see |
|---|---|---|
| TI-84 Plus CE | MATH ▶ (NUM menu) 9 (gcd(), then 24 , 36 ) ENTER. Item 8 is lcm( | gcd(24,36) = 12 |
| Casio fx-991CW / fx-82CW (ClassWiz CW) | CATALOG, choose Numeric Calc, then GCD; type 24 , 36 ) EXE | GCD(24,36) = 12 |
| Casio fx-991ES PLUS 2nd edition / fx-115ES PLUS | The GCD and LCM functions are printed above keys on this model; press the shift key shown, then GCD, type 24 , 36 ) and = | 12 |
| Casio fx-991EX / fx-570MS / fx-991MS | No GCD key on most of these. Use Euclid: 36 − 24 = gives 12, then 24 ÷ 12 = gives exactly 2, so the GCF is 12 | 12, then 2 |
The TI-84 and fx-991CW keystrokes follow the makers' manuals. Menu layouts change between models and software versions, so check your own model's manual before an exam. On any calculator you can always do Euclid with division: keep dividing the last divisor by the last remainder until it divides exactly.
14.3 Practice problems with answers
1. GCF(8, 12)
4. (8 = 2³, 12 = 2² × 3)
2. GCF(16, 24)
8.
3. GCF(28, 42)
14. (2 × 7)
4. GCF(36, 48)
12.
5. GCF(18, 30, 42)
6.
6. GCF(17, 51)
17. (51 = 3 × 17, so 17 divides both)
7. GCF(49, 50)
1. Consecutive numbers are always coprime.
8. GCF(0, 0)
Undefined. There is no greatest common divisor of 0 and 0.
9. Factor 15x²y − 25xy²
5xy(3x − 5y).
10. Trap: factor −6m³ − 9m² − 3m
−3m(2m² + 3m + 1). Every sign flips, and the last term leaves 1.
14.4 Mistakes that lose marks
- Taking the highest power of a shared prime. That gives the LCM, not the GCF.
- Including a prime that is missing from one number. 5 is in 60 but not in 24, so it cannot be in GCF(24, 60).
- Giving a common factor instead of the greatest one. 6 divides 24 and 36, but 12 is the GCF.
- Dropping the 1 when a term equals the GCF: 4ab ÷ 4ab = 1.
- Factoring out a negative but forgetting to change the sign of every term inside the brackets.
- Including a letter that is missing from one term (x is not in 18y, so x is not in GCF(12xy, 18y)).
- Not checking: always divide back, or multiply the factored form out.
🎯 15. When to Use This Method
Use the GCF when:
- You want the largest equal group size, tile, piece or batch.
- You need a fraction or a ratio in lowest terms.
- You are starting any factoring problem in algebra (always factor out the GCF first).
- You are reducing a screen ratio such as 1920:1080 to 16:9 (GCF 120).
Use something else when:
- You need a common denominator or the next time two cycles line up: that is the LCM.
- You want all the factors of a single number: use the factor calculator.
- The GCF is 1 and you still need to factor: try grouping, difference of squares or the quadratic formula.
Real-world examples:
- A florist has 36 roses and 24 tulips and wants identical bouquets: GCF 12 bouquets, each with 3 roses and 2 tulips.
- A 54 by 36 cm floor: the biggest square tile is GCF(54, 36) = 18 cm, so 3 by 2 tiles.
- Gear teeth 48 and 30: GCF 6 tells an engineer how often the same teeth meet.
- Pixels 1920 by 1080: GCF 120 gives the aspect ratio 16:9.
| Your situation | Fastest method |
|---|---|
| Two small numbers (under 100) | Listing factors or mental prime factorization |
| Two or three numbers, need the LCM as well | Prime factorization |
| Big numbers, or a number with a large prime factor | Euclid's algorithm |
| Classroom work with 2 to 4 numbers | Ladder (cake) method |
| Algebra terms | Coefficient GCF times shared letters at lowest power |
| Many problems at once | Batch tab, or Excel GCD down a column |
🔧 16. Common Mistakes and Troubleshooting
My GCF is bigger than one of the numbers
Cause: You multiplied the highest powers, which gives the LCM.
Fix: Use the lowest power of each shared prime. The GCF can never exceed the smallest number.
My answer divides both numbers but the book has a bigger one
Cause: You found a common factor, not the greatest.
Fix: Divide both numbers by your answer. If the results still share a factor, multiply it in.
Excel shows #NUM!
Cause: A negative number, or a value of 253 or more.
Fix: Use ABS(), or this calculator for very large numbers.
The calculator says "undefined"
Cause: Every input is 0.
Fix: Add a non-zero number. GCF(0, n) = |n|.
My factored form does not multiply back
Cause: A sign or a 1 was dropped inside the brackets.
Fix: Multiply the GCF into each bracket term and compare term by term.
I got 4ab but the answer key has −4ab
Cause: Both are correct; the key factored out a negative because the first term is negative.
Fix: Switch the sign option in Section 2 to match your teacher.
The tool will not read my expression
Cause: Brackets, decimals or fractions in the coefficients.
Fix: Expand first, and use whole numbers. Multiply through by a number to clear decimals.
Python gives a TypeError
Cause: math.gcd got a float, or you are on Python 3.8 with more than two numbers.
Fix: Pass integers, and use functools.reduce on old Python versions.
R says it cannot find gcd
Cause: Base R has no gcd function.
Fix: Paste the Euclid function from Section 10 or load the numbers package.
My Casio has no GCD key
Cause: Older models such as the fx-570MS lack it.
Fix: Use Euclid with the divide key, as shown in Section 14.2.
⚖ 17. Assumptions and Limitations
Assumptions
- Whole numbers only. The GCF is defined for integers. A decimal such as 0.75 is rejected with a message, because 0.75 is not a whole number. Scale by a power of 10 first.
- Absolute values. Signs are dropped for number GCFs, because GCF(−a, b) = GCF(a, b). The answer is always positive.
- Zero handling. A 0 is skipped (GCF(0, n) = |n|). If every input is 0 the GCF is reported as undefined.
- Algebra terms are monomials with whole-number coefficients. Letters are single characters with whole-number powers. Like terms are not combined, so type the expression already simplified.
- Sign convention for polynomials. By default a negative GCF is factored out when the first term is negative. Both signs give a correct factorization.
Limitations
- Up to 50 numbers of up to 200 digits each. Euclid is exact at any size; prime factorization is skipped if a number has two very large prime factors, and the page says so.
- Up to 30 algebra terms. Brackets, fractional or negative exponents and decimal coefficients are not supported.
- It finds the GCF of monomials, not the GCD of two general polynomials such as x² − 1 and x² + 2x + 1 (that needs polynomial division).
- It does not do the next factoring step (grouping, trinomials). Use the algebra calculator or the quadratic formula calculator for that.
🏁 18. Conclusion
What the answer is
A GCF calculator gives one number, or one monomial, that divides everything you entered: GCF(24, 36) = 12 and GCF(12x³y², 18x²y, 30xy⁴) = 6xy. This page also gives the LCM, the prime form, the factored polynomial and a check.
What it tells you
The GCF is the size of the largest equal group, the factor that simplifies a fraction in one move, and the first thing to pull out of any polynomial. A GCF of 1 tells you the numbers are coprime and the fraction is already in lowest terms.
Watch out for
The highest-power mix-up (that is the LCM), a common factor that is not the greatest, a dropped 1 inside the brackets, and sign changes when you factor out a negative. Always divide back or multiply out to check.
Next steps
Practise with Section 14.3, then move on to listing all factors with the factor calculator, mixed numbers with the mixed number calculator, and factoring quadratics with the quadratic formula calculator. Whenever a fraction, a ratio or a polynomial needs simplifying, come back to this GCF calculator.
❓ 19. Frequently Asked Questions
Q1. What is the GCF of two numbers?
The GCF (greatest common factor) of two numbers is the largest whole number that divides both with no remainder. For 24 and 36 it is 12, because 12 divides both and no larger number does.
Q2. How do you find the GCF?
Find the GCF by writing each number as a product of primes and multiplying the shared primes at their lowest power. For 24 = 2³ × 3 and 36 = 2² × 3², that is 2² × 3 = 12. For big numbers, Euclid's algorithm (divide and keep the remainder) is faster.
Q3. What is the greatest common factor of 24 and 36?
The greatest common factor of 24 and 36 is 12. 24 = 2³ × 3 and 36 = 2² × 3², so the shared part is 2² × 3 = 12. Their LCM is 72.
Q4. What is the greatest common factor of 12 and 18?
The greatest common factor of 12 and 18 is 6. 12 = 2² × 3 and 18 = 2 × 3², and the shared primes at their lowest power are 2 × 3 = 6.
Q5. What is the greatest common factor of 6 and 9?
The greatest common factor of 6 and 9 is 3. The factors of 6 are 1, 2, 3, 6 and the factors of 9 are 1, 3, 9, so the largest shared factor is 3.
Q6. What is the greatest common factor of 8 and 12?
The greatest common factor of 8 and 12 is 4. 8 = 2³ and 12 = 2² × 3, so the GCF is 2² = 4.
Q7. What is the greatest common factor of 36 and 48?
The greatest common factor of 36 and 48 is 12. 36 = 2² × 3² and 48 = 2⁴ × 3, so the GCF is 2² × 3 = 12.
Q8. How do you find the GCF of 3 numbers?
Find the GCF of 3 numbers by finding the GCF of the first two, then the GCF of that answer and the third number. GCF(48, 72, 120) = GCF(GCF(48, 72), 120) = GCF(24, 120) = 24. Prime factorization or the ladder method also work.
Q9. How do you find the GCF of monomials with variables and exponents?
Find the GCF of monomials by multiplying the GCF of the coefficients by each letter that appears in every term, raised to its lowest power. For 12x³y², 18x²y and 30xy⁴ the GCF is 6xy.
Q10. How do you factor out the GCF of a polynomial?
Factor out the GCF by finding the GCF of all the terms, dividing each term by it, and writing the GCF outside brackets. 12x³y² + 18x²y − 30xy⁴ = 6xy(2x²y + 3x − 5y³). Multiply back to check.
Q11. What does it mean to factor out the opposite of the GCF?
Factoring out the opposite of the GCF means taking out the negative of the GCF so the first term inside the brackets is positive. −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1). Every sign inside the brackets changes.
Q12. What is the difference between GCF and LCM?
The GCF is the largest number that divides all the numbers, and the LCM is the smallest number that all of them divide into. For 24 and 36 the GCF is 12 and the LCM is 72. For two numbers, GCF × LCM = the product of the numbers.
Q13. Is GCF the same as GCD and HCF?
Yes, GCF, GCD and HCF are three names for the same number. GCF (greatest common factor) is common in the USA, HCF (highest common factor) in India and the UK, and GCD (greatest common divisor) in higher mathematics, Excel and programming.
Q14. What is the GCF of two numbers that have no common factors?
The GCF of two numbers with no common prime factor is 1, and the numbers are called relatively prime or coprime. For example GCF(35, 64) = 1, even though neither number is prime.
Q15. Can the GCF be negative or zero?
The GCF of numbers is always a positive whole number, so it cannot be negative or zero. GCF(0, n) equals |n|, and GCF(0, 0) is undefined. In algebra you may choose to factor out a negative GCF, such as −4ab.
Q16. How do you find the GCF on a calculator like a TI-84 or Casio?
On a TI-84 press MATH, move right to NUM, choose 9: gcd(, then type 24, 36) and ENTER to get 12. On a Casio fx-991CW use CATALOG, Numeric Calc, GCD. Models without a GCD key can do Euclid's algorithm with the divide key.
Q17. How do you find the GCF in Excel?
Use the Excel GCD function: =GCD(A2:A3) returns 12 when A2 is 24 and A3 is 36. It takes up to 255 numbers, but it returns #NUM! for negative values, so wrap them in ABS().
Q18. How do you find the GCF in R?
Base R has no gcd function, so write Euclid's algorithm in a few lines or use numbers::GCD(24, 36), which returns 12. Reduce(gcd2, c(48, 72, 120)) folds it over a list. The full script is in Section 10.
Q19. How do you find the GCF in Python?
Use math.gcd: math.gcd(24, 36) returns 12, and from Python 3.9 math.gcd(48, 72, 120) takes any number of values. For polynomials, sympy.factor_terms(12*x**3*y**2 + 18*x**2*y - 30*x*y**4) returns 6*x*y*(2*x**2*y + 3*x - 5*y**3).
Q20. How do you use the GCF to simplify fractions?
Divide the numerator and the denominator by their GCF to get the fraction in lowest terms in one step. For 24/36 the GCF is 12, so 24/36 = 2/3. For 84/126 the GCF is 42, so it is also 2/3.
📑 20. Cite This Tool
Pushbanathan, R. (2026). GCF calculator: Greatest common factor of numbers, monomials and polynomials with steps [Interactive calculator]. StatsUnlock. https://statsunlock.com/gcf-calculator/@misc{statsunlock_gcf_2026, author={Pushbanathan, Reegan}, title={GCF Calculator: Greatest Common Factor of Numbers, Monomials and Polynomials with Steps}, year={2026}, publisher={StatsUnlock}, note={Interactive calculator, accessed 2 December 2026}, url={https://statsunlock.com/gcf-calculator/}}The greatest common factor was computed with the StatsUnlock GCF Calculator (Pushbanathan, 2026), which uses exact integer arithmetic, prime factorization and Euclid's algorithm, and verifies each answer by division.🔗 21. Related Tools
List every factor and factor pair of one number, and see if it is prime.
Open tool →The next step after factoring out the GCF: simplify and solve expressions.
Open tool →Solve what is left inside the brackets when it is a quadratic.
Open tool →Add, subtract and simplify mixed numbers using the GCF and LCM.
Open tool →A full online scientific calculator for checking divisions and powers.
Open tool →Quick add, subtract, multiply and divide for the Euclid steps.
Open tool →Write very large GCF and LCM results in standard form.
Open tool →Make random number pairs for GCF practice and worksheets.
Open tool →📖 22. Glossary of Terms
| Term | Plain-English meaning |
|---|---|
| Bézout identity | The fact that the GCF of a and b can be written as ax + by for some whole numbers x and y. For 24 and 36: 24(−1) + 36(1) = 12. |
| Coefficient | The number part of a term. In 18x²y the coefficient is 18. |
| Common factor | A number that divides every number in a set. 6 is a common factor of 24 and 36, but not the greatest. |
| Composite number | A whole number above 1 with more than two factors, such as 24. |
| Coprime (relatively prime) | Numbers whose GCF is 1, such as 35 and 64. |
| Divisor | Another word for factor: a number that divides another exactly. |
| Euclid's algorithm | A method from about 300 BC: divide, keep the remainder, repeat. The last non-zero remainder is the GCF. |
| Exponent (power, index) | The small raised number showing repeated multiplication. In 2³, the exponent is 3. |
| Factor | A whole number that divides another with no remainder. The factors of 12 are 1, 2, 3, 4, 6, 12. |
| Factored form | An expression written as a product, such as 6xy(2x²y + 3x − 5y³). |
| GCD | Greatest common divisor, the same as the GCF. Excel and programming languages use this name. |
| GCF | Greatest common factor: the largest whole number (or monomial) dividing every number (or term). |
| HCF | Highest common factor, the same as the GCF. Common in India and the UK. |
| Ladder (cake) method | Dividing all numbers by a shared prime, row after row, until no prime is shared. The primes on the left multiply to the GCF. |
| LCM | Least common multiple: the smallest positive number that every number divides into. |
| Monomial | A single algebra term: a coefficient times letters with whole-number powers, such as −4ab. |
| Polynomial | A sum of monomials, such as 12x³y² + 18x²y − 30xy⁴. |
| Prime factorization | Writing a number as a product of primes, such as 36 = 2² × 3². |
| Prime number | A whole number above 1 whose only factors are 1 and itself, such as 2, 3, 5, 7. |
| Quotient | The result of a division. 36 ÷ 12 has quotient 3. |
| Remainder | What is left after whole-number division. 36 ÷ 24 leaves remainder 12. |
📚 23. References
Peer-reviewed sources behind the methods in this GCF calculator: Euclid's algorithm and its speed, GCD of many integers, polynomial GCDs, exact integer arithmetic, primality and factoring, and research on how students learn divisibility and algebra.
- Baladi, V., & Vallée, B. (2005). Euclidean algorithms are Gaussian. Journal of Number Theory, 110(2), 331–386. https://doi.org/10.1016/j.jnt.2004.08.008
- Bradley, G. H. (1970). Algorithm and bound for the greatest common divisor of n integers. Communications of the ACM, 13(7), 433–436. https://doi.org/10.1145/362686.362694
- Brown, W. S. (1971). On Euclid's algorithm and the computation of polynomial greatest common divisors. Journal of the ACM, 18(4), 478–504. https://doi.org/10.1145/321662.321664
- Collins, G. E. (1967). Subresultants and reduced polynomial remainder sequences. Journal of the ACM, 14(1), 128–142. https://doi.org/10.1145/321371.321381
- Dixon, J. D. (1970). The number of steps in the Euclidean algorithm. Journal of Number Theory, 2(4), 414–422. https://doi.org/10.1016/0022-314X(70)90044-2
- Goldberg, D. (1991). What every computer scientist should know about floating-point arithmetic. ACM Computing Surveys, 23(1), 5–48. https://doi.org/10.1145/103162.103163
- Havas, G., Majewski, B. S., & Matthews, K. R. (1998). Extended GCD and Hermite normal form algorithms via lattice basis reduction. Experimental Mathematics, 7(2), 125–136. https://doi.org/10.1080/10586458.1998.10504362
- Hensley, D. (1994). The number of steps in the Euclidean algorithm. Journal of Number Theory, 49(2), 142–182. https://doi.org/10.1006/jnth.1994.1088
- Lehmer, D. H. (1938). Euclid's algorithm for large numbers. The American Mathematical Monthly, 45(4), 227–233. https://doi.org/10.1080/00029890.1938.11990797
- Miller, G. L. (1976). Riemann's hypothesis and tests for primality. Journal of Computer and System Sciences, 13(3), 300–317. https://doi.org/10.1016/S0022-0000(76)80043-8
- Möller, N. (2008). On Schönhage's algorithm and subquadratic integer GCD computation. Mathematics of Computation, 77(261), 589–607. https://doi.org/10.1090/S0025-5718-07-02017-0
- Pollard, J. M. (1975). A Monte Carlo method for factorization. BIT Numerical Mathematics, 15(3), 331–334. https://doi.org/10.1007/BF01933667
- Rabin, M. O. (1980). Probabilistic algorithm for testing primality. Journal of Number Theory, 12(1), 128–138. https://doi.org/10.1016/0022-314X(80)90084-0
- Sfard, A., & Linchevski, L. (1994). The gains and the pitfalls of reification: The case of algebra. Educational Studies in Mathematics, 26(2–3), 191–228. https://doi.org/10.1007/BF01273663
- Shallit, J. (1994). Origins of the analysis of the Euclidean algorithm. Historia Mathematica, 21(4), 401–419. https://doi.org/10.1006/hmat.1994.1031
- Sorenson, J. (1994). Two fast GCD algorithms. Journal of Algorithms, 16(1), 110–144. https://doi.org/10.1006/jagm.1994.1006
- Stein, J. (1967). Computational problems associated with Racah algebra. Journal of Computational Physics, 1(3), 397–405. https://doi.org/10.1016/0021-9991(67)90047-2
- Vallée, B. (1998). Dynamics of the binary Euclidean algorithm: Functional analysis and operators. Algorithmica, 22(4), 660–685. https://doi.org/10.1007/PL00009246
- Weber, K. (1995). The accelerated integer GCD algorithm. ACM Transactions on Mathematical Software, 21(1), 111–122. https://doi.org/10.1145/200979.201042
- Zazkis, R., & Campbell, S. (1996). Divisibility and multiplicative structure of natural numbers: Preservice teachers' understanding. Journal for Research in Mathematics Education, 27(5), 540–563. https://doi.org/10.5951/jresematheduc.27.5.0540
