Prime Factorization Calculator Formula

Understand the math behind the prime factorization calculator. Each variable explained with a worked example.

Formulas Used

Div By 2

div_by_2 = mod(n, 2) == 0 ? 1 : 0

Div By 3

div_by_3 = mod(n, 3) == 0 ? 1 : 0

Div By 5

div_by_5 = mod(n, 5) == 0 ? 1 : 0

Div By 7

div_by_7 = mod(n, 7) == 0 ? 1 : 0

Sqrt N

sqrt_n = sqrt(n)

Is Even

is_even = mod(n, 2) == 0 ? 1 : 0

Variables

VariableDescriptionDefault
nNumber84

How It Works

Prime Factorization

What Is It?

Every integer greater than 1 can be written as a product of prime numbers in exactly one way (Fundamental Theorem of Arithmetic).

Method: Trial Division

1. Start with the smallest prime (2) 2. If it divides the number, it is a factor; divide and repeat 3. If not, try the next prime (3, 5, 7, 11, ...) 4. Stop when you reach sqrt(n)

Divisibility Quick Checks

  • By 2: last digit is even
  • By 3: digit sum is divisible by 3
  • By 5: last digit is 0 or 5
  • This calculator shows divisibility checks. For full factorization of large numbers, a step-by-step approach is needed.

    Worked Example

    Check divisibility of 84.

    n = 84
    1. 0184 / 2 = 42 (divisible by 2)
    2. 0284 / 3 = 28 (divisible by 3)
    3. 0384 / 5 = 16.8 (not divisible by 5)
    4. 0484 / 7 = 12 (divisible by 7)
    5. 0584 = 2² × 3 × 7

    Frequently Asked Questions

    What is a prime number?

    A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Examples: 2, 3, 5, 7, 11, 13...

    What is the fundamental theorem of arithmetic?

    Every integer greater than 1 is either prime or can be written as a unique product of prime numbers (up to ordering).

    Why do we only check up to sqrt(n)?

    If n has a factor larger than sqrt(n), it must also have a corresponding factor smaller than sqrt(n). So checking up to sqrt(n) is sufficient.

    Learn More

    Guide

    How to Simplify Radicals - Complete Guide

    Learn how to simplify radical expressions step by step. Covers square roots, cube roots, rationalizing denominators, and operations with radicals.

    Ready to run the numbers?

    Open Prime Factorization Calculator