Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Greatest Common Factor (GCF / GCD) Calculator

Enter 2 or more whole numbers separated by commas (,). You can find the GCF of 3 or more at once, and the prime factorization of each number and their common prime factors are shown too.

Enter only whole numbers of 1 or more, separated by commas (for example, 12, 18). 0, negative numbers and decimals cannot be used.
Result
Enter whole numbers separated by commas in the field on the left and press "Calculate". The result will appear here.

What you can do on this page

  • Enter whole numbers separated by commas and get the greatest common factor (GCF, also called the GCD) on the spot
  • Not just 2 numbers: find the GCF of 3 or more at once, such as "16, 88, 104"
  • The prime factorization of each number and the prime factors they share are shown too, so you also learn how to find and check the answer
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
Only whole numbers of 1 or more (positive whole numbers) can be used. This page does not handle 0, negative numbers or decimals.

What is this calculation used for?

Simplifying fractions (its most familiar use)

To simplify \(\frac{12}{18}\), divide the numerator and the denominator by their GCF, 6, and you get \(\frac{2}{3}\) in one step.
Instead of dividing by 2, then by 3 and so on, the GCF takes the fraction to simplest form at once. From elementary school math to everyday work, this is the most common use of the GCF.

Splitting things into equal groups with nothing left over (parties and handouts)

You want to pack 24 cookies and 36 juice boxes into as many identical bags as possible, with nothing left over. The largest number of bags is \(\gcd(24, 36) = 12\), with 2 cookies and 3 juice boxes in each bag.
Making prize bags for a school fair or putting supplies into matching kits: this is the standard calculation for splitting different kinds of items into equal groups.

Laying tiles and cutting paper (DIY and design)

To cover a floor that is 84 inches by 108 inches (7 ft by 9 ft) with square tiles, with no gaps and no cutting, the largest tile you can use is \(\gcd(84, 108) = 12\), a 12-inch square tile (7 rows of 9 tiles).
Dividing a rectangle into the largest possible squares is used when tiling floors and walls, and when cutting cards of the same size from a large sheet of paper without waste.

Designing gears (machines and clocks)

If the tooth counts of two meshing gears have a large GCF, the same teeth hit each other again and again, and they wear unevenly. So in machine design, a basic rule is to make the tooth counts as close to relatively prime (GCF of 1) as possible.
The gears inside cars and clocks use this idea of keeping the GCF small.

The encryption that keeps the internet safe

RSA encryption, used for online shopping and online banking, needs to check whether two numbers are relatively prime while making its keys, and the Euclidean algorithm does that job.
A method for the GCF from more than 2,000 years ago now protects communication all over the world. It shows how long-lived mathematics can be.

Formula

Using prime factorization (the basic method)
Standard notation (the usual math form)
\(\gcd(a,\ b)\) \(=\) \(p_1 \times p_2 \times \cdots\)
In words (symbols replaced with words)
② \(\gcd(a, b)\): GCF of \(a\) and \(b\) \(=\) ① product of all the common prime factors
The formula in words
① Write both numbers as products of primes and multiply all the \(p_1, p_2, \ldots\): common prime factors
② to get the \(\gcd(a, b)\): greatest common factor
Quick example
The GCF of 12 and 18 (12 = 2 × 2 × 3 and 18 = 2 × 3 × 3, so they share one 2 and one 3) is
GCF of 12 and 18 \(=\) product of the common prime factors (2 and 3)
\(12 = 2 \times 2 \times 3,\quad 18 = 2 \times 3 \times 3\)
\(\gcd(12,\ 18) = 2 \times 3 = 6\)
Key idea
The prime factors of a whole number are the primes you get when you break it into a product of primes only. If the same prime appears several times in both numbers, use it as many times as it appears in the number with fewer copies. For example, 8 = 2 × 2 × 2 and 12 = 2 × 2 × 3: 2 appears 3 times in 8 and 2 times in 12, so they share it 2 times. So \(\gcd(8, 12) = 2 \times 2 = 4\).
The Euclidean algorithm (the method for large numbers)
Standard notation (the usual math form)
\(\gcd(a,\ b)\) \(=\) \(\gcd(b,\ a \bmod b)\)
In words (symbols replaced with words)
② \(\gcd(a, b)\): GCF of \(a\) and \(b\) \(=\) ① GCF of "the smaller number \(b\)" and "the remainder of \(a \div b\)"
The formula in words
① Divide the larger number by the smaller one, and replace the pair with the pair "smaller number \(b\)" and "remainder \(a \bmod b\)"
② and the \(\gcd(a, b)\): greatest common factor stays the same. The numbers keep getting smaller, and when the remainder becomes 0, the number you divided by is the GCF
Quick example
The GCF of 48 and 18 (48 ÷ 18 = 2 R12) is
GCF of 48 and 18 \(=\) GCF of "18" and "remainder 12"
\(48 = 18 \times 2 + 12\)
\(18 = 12 \times 1 + 6\)
\(12 = 6 \times 2 + 0\)
\(\gcd(48,\ 18) = 6\)
Key idea
Prime factorization suddenly gets hard as the numbers grow (try factoring a number like 134221: it is actually 79 × 1699). With the Euclidean algorithm, you only repeat "divide and take the remainder", and it always reaches the GCF, however large the numbers are. The method appears in Euclid's "Elements" from around the 3rd century BC and is often called the oldest algorithm in the world.
GCF of 3 or more numbers
Standard notation (the usual math form)
\(\gcd(a,\ b,\ c)\) \(=\) \(\gcd(\) \(\gcd(a,\ b)\) \(,\) \(c\) \()\)
In words (symbols replaced with words)
③ \(\gcd(a, b, c)\): GCF of the three numbers \(=\) \(\gcd(\) ① GCF of \(a\) and \(b\), found first \(,\) ② \(c\): the remaining number \()\)
The formula in words
① First find the \(\gcd(a, b)\): GCF of two of the numbers
② then find the GCF of that result and the \(c\): the remaining number
③ to get the \(\gcd(a, b, c)\): GCF of the three numbers
Quick example
The GCF of 16, 88 and 104 (first, the GCF of 16 and 88 is 8) is
GCF of 16, 88 and 104 \(=\) \(\gcd(\) GCF of 16 and 88 (8) \(,\) remaining number (104) \()\)
\(\gcd(16,\ 88) = 8\)
\(\gcd(8,\ 104) = 8\)
\(\gcd(16,\ 88,\ 104) = 8\)
Key idea
However many whole numbers there are, finding the GCF two at a time gives the GCF of all of them. It works the same for 4 or more numbers, and changing the order does not change the answer. The calculator on this page also works through the numbers two at a time, exactly as in this formula.
How the GCF is related to the LCM
Standard notation (the usual math form)
\(\gcd(a,\ b)\) \(\times\) \(\mathrm{lcm}(a,\ b)\) \(=\) \(a \times b\)
In words (symbols replaced with words)
① \(\gcd(a, b)\): greatest common factor \(\times\) ② \(\mathrm{lcm}(a, b)\): least common multiple \(=\) ③ \(a \times b\): product of the two numbers
The formula in words
① Multiply the \(\gcd(a, b)\): greatest common factor
② by the \(\mathrm{lcm}(a, b)\): least common multiple
③ and you always get the \(a \times b\): product of the two numbers
Quick example
For 12 and 18 (GCF 6, LCM 36):
GCF (6) \(\times\) LCM (36) \(=\) product of the two numbers (12 × 18)
\(6 \times 36 = 216\)
\(12 \times 18 = 216\)
Key idea
With this relationship, once you know the GCF you can find the LCM as \(\mathrm{lcm}(a, b) = a \times b \div \gcd(a, b)\) (for large numbers this is more reliable than listing multiples). Note that this relationship holds as is only for two numbers. For 3 or more numbers it does not hold in general.
The greatest common factor is the largest positive whole number that divides every one of the numbers evenly. For small numbers, multiply the prime factors they share. For large numbers, use the Euclidean algorithm, which keeps replacing the pair with the remainder.

Symbols and terms

Symbols

\(\gcd(a, b)\) G C D of a and b The greatest common factor of \(a\) and \(b\). The symbol comes from "greatest common divisor" (GCD). US schools usually say greatest common factor (GCF) and may write \(\mathrm{GCF}(a, b)\), which is exactly the same thing.
\(a \bmod b\) a mod b The remainder when \(a\) is divided by \(b\). (Example - \(48 \bmod 18 = 12\), because 48 ÷ 18 = 2 R12)
\(\mathrm{lcm}(a, b)\) L C M of a and b The least common multiple of \(a\) and \(b\), from the first letters of "least common multiple". (Example - \(\mathrm{lcm}(12, 18) = 36\))
\(p_1, p_2, \ldots\) p sub 1, p sub 2, and so on The common prime factors listed in order. The small lowered numbers (subscripts) only show first, second and so on. They are not used in the calculation.
\(\cdots\) dots (ellipsis) A symbol for "and so on, following the same pattern". Here it shows that you multiply the prime factors in the same way however many there are.

Terms

factor A positive whole number that divides a whole number evenly. 12 has 6 factors - 1, 2, 3, 4, 6 and 12.
common factor A factor shared by two or more whole numbers. The common factors of 12 and 18 are 1, 2, 3 and 6. Every common factor is a factor of the greatest common factor (6 here).
greatest common factor (GCF) The largest of the common factors. US schools call it the greatest common factor (GCF). In higher math and programming it is usually called the greatest common divisor (GCD). Both are the same number.
prime number A whole number of 2 or more whose only factors are 1 and itself - 2, 3, 5, 7, 11, 13, … 1 is not a prime number.
prime factorization Writing a whole number as a product of prime numbers only. (Example - \(12 = 2 \times 2 \times 3\)) Each prime used is called a prime factor.
relatively prime When the GCF of two whole numbers is 1 (their only common factor is 1). Like 17 and 13, they share no prime factors at all. Also called coprime.
Euclidean algorithm A way to find the GCF by repeating "divide the larger number by the smaller one, and replace the pair with the smaller number and the remainder". It is taught in high school and college number theory and computer science. Known since ancient times, it is often called the oldest algorithm in the world.
least common multiple (LCM) The smallest positive whole number that is a multiple of two or more whole numbers. It is used to find a common denominator for fractions. For two numbers, \(\gcd(a, b) \times \mathrm{lcm}(a, b) = a \times b\).

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over these topics is the quickest way forward.

Multiplication facts and division with remainders (Grades 3–4)
  • Being able to tell "divides evenly" from "has a remainder"
  • Being able to do division with remainders, such as 48 ÷ 18 = 2 R12
Factors and common factors (Grades 4–6)
  • Being able to list all the factors of 12 - 1, 2, 3, 4, 6, 12
  • Being able to find the factors two numbers share (common factors)
Simplifying fractions (Grades 4–5)
  • Knowing that dividing the numerator and the denominator by the same number does not change the value of a fraction
Prime numbers and prime factorization (Grades 4–6)
  • Being able to recognize prime numbers (numbers with no factors other than 1 and themselves)
  • Being able to break a whole number into a product of primes, as in \(12 = 2 \times 2 \times 3\)

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the GCF of two numbers
First number a 12
Second number b 18
GCF gcd(a, b) =GCD(B1,B2)
Table to find the GCF of 3 or more numbers
Number 1 16
Number 2 88
Number 3 104
GCF =GCD(B1:B3)
Table to check the Euclidean algorithm
Larger number a 48
Smaller number b 18
Remainder of a ÷ b (a mod b) =MOD(B1,B2)
gcd(a, b) =GCD(B1,B2)
gcd(b, remainder) (same as above) =GCD(B2,B3)
Table to check GCF × LCM = product of the two numbers
First number a 12
Second number b 18
GCF gcd(a, b) =GCD(B1,B2)
LCM lcm(a, b) =LCM(B1,B2)
gcd × lcm =B3*B4
a × b (same as above) =B1*B2
Excel has a built-in GCD function for the greatest common factor. "=GCD(B1,B2)" gives the GCF of the values in B1 and B2, so the first table shows 6 in B3.
With a range, as in "=GCD(B1:B3)" in the second table, you can find the GCF of 3 or more numbers at once (B4 shows 8).
The third table checks the Euclidean algorithm. With the MOD function (the remainder), you can confirm that gcd(a, b) and gcd(b, remainder) are the same value (both 6).
In the fourth table, gcd × lcm and a × b both come to 216, which confirms the relationship with the LCM. Just replace the input numbers with your own.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the GCF of two numbers
First number a 12
Second number b 18
GCF gcd(a, b) =GCD(B1,B2)
Table to find the GCF of 3 or more numbers
Number 1 16
Number 2 88
Number 3 104
GCF =GCD(B1:B3)
Table to check the Euclidean algorithm
Larger number a 48
Smaller number b 18
Remainder of a ÷ b (a mod b) =MOD(B1,B2)
gcd(a, b) =GCD(B1,B2)
gcd(b, remainder) (same as above) =GCD(B2,B3)
Table to check GCF × LCM = product of the two numbers
First number a 12
Second number b 18
GCF gcd(a, b) =GCD(B1,B2)
LCM lcm(a, b) =LCM(B1,B2)
gcd × lcm =B3*B4
a × b (same as above) =B1*B2
Google Sheets has GCD, LCM and MOD functions with the same names as Excel, so the same formulas work as is.
Copy the whole table, paste it into cell A1, and replace the input numbers with your own.

How to calculate it in Python

from math import gcd
from functools import reduce

numbers = [330, 75, 450, 225]  # whole numbers to find the GCF of (any number of them)

greatest_common_divisor = reduce(gcd, numbers)  # applies gcd two at a time from the start

print(f"GCF of {numbers}: {greatest_common_divisor}")
Runs with the standard library only. math.gcd finds the GCF of two whole numbers, and reduce takes care of the "two at a time" part. Replace the list at the top with your own numbers and run it (this example prints 15).

How to write it in LaTeX and other math languages (copy and paste)

Using prime factorization (the basic method)
gcd(a, b) = p₁ × p₂ × ⋯
\gcd(a, b) = p_1 \times p_2 \times \cdots
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>gcd</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo>
    <mo>=</mo>
    <msub><mi>p</mi><mn>1</mn></msub>
    <mo>&#xD7;</mo>
    <msub><mi>p</mi><mn>2</mn></msub>
    <mo>&#xD7;</mo>
    <mo>&#x22EF;</mo>
  </mrow>
</math>
gcd(a, b) = p_1 xx p_2 xx cdots
GCD[a, b]
igcd(a, b);
g = gcd(a, b);
gcd(a, b) = p_1 × p_2 × ⋯
The Euclidean algorithm (the method for large numbers)
gcd(a, b) = gcd(b, a mod b)
\gcd(a, b) = \gcd(b,\ a \bmod b)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>gcd</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo>
    <mo>=</mo>
    <mi>gcd</mi>
    <mo>(</mo><mi>b</mi><mo>,</mo>
    <mi>a</mi><mspace width="0.3em"/><mi>mod</mi><mspace width="0.3em"/><mi>b</mi>
    <mo>)</mo>
  </mrow>
</math>
gcd(a, b) = gcd(b, a mod b)
GCD[a, b] == GCD[b, Mod[a, b]]
igcd(a, b) = igcd(b, a mod b);
gcd(a, b) == gcd(b, mod(a, b))
gcd(a, b) = gcd(b, a mod b)
GCF of 3 or more numbers
gcd(a, b, c) = gcd(gcd(a, b), c)
\gcd(a, b, c) = \gcd(\gcd(a, b),\ c)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>gcd</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>,</mo><mi>c</mi><mo>)</mo>
    <mo>=</mo>
    <mi>gcd</mi>
    <mo>(</mo>
    <mi>gcd</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo>
    <mo>,</mo><mi>c</mi>
    <mo>)</mo>
  </mrow>
</math>
gcd(a, b, c) = gcd(gcd(a, b), c)
GCD[a, b, c]
igcd(igcd(a, b), c);
g = gcd(gcd(a, b), c);
gcd(a, b, c) = gcd(gcd(a, b), c)
How the GCF is related to the LCM
gcd(a, b) × lcm(a, b) = a × b
\gcd(a, b) \times \mathrm{lcm}(a, b) = a \times b
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>gcd</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo>
    <mo>&#xD7;</mo>
    <mi>lcm</mi>
    <mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo>
    <mo>=</mo>
    <mi>a</mi>
    <mo>&#xD7;</mo>
    <mi>b</mi>
  </mrow>
</math>
gcd(a, b) xx lcm(a, b) = a xx b
GCD[a, b]*LCM[a, b] == a*b
igcd(a, b)*ilcm(a, b) = a*b;
gcd(a, b)*lcm(a, b) == a*b
gcd(a, b) × lcm(a, b) = a × b

How to have ChatGPT  do the calculation

You are a calculation assistant for whole numbers. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

For the four whole numbers 330, 75, 450 and 225, find each of the following:
1. The greatest common factor (GCF) of the four numbers
2. The prime factorization of each number
3. The prime factors that all four numbers share

Show the formulas you used and the numbers from the execution result.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.