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 : 0Div By 3
div_by_3 = mod(n, 3) == 0 ? 1 : 0Div By 5
div_by_5 = mod(n, 5) == 0 ? 1 : 0Div By 7
div_by_7 = mod(n, 7) == 0 ? 1 : 0Sqrt N
sqrt_n = sqrt(n)Is Even
is_even = mod(n, 2) == 0 ? 1 : 0Variables
| Variable | Description | Default |
|---|---|---|
n | Number | 84 |
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
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
- 0184 / 2 = 42 (divisible by 2)
- 0284 / 3 = 28 (divisible by 3)
- 0384 / 5 = 16.8 (not divisible by 5)
- 0484 / 7 = 12 (divisible by 7)
- 0584 = 2² × 3 × 7
Ready to run the numbers?
Open Prime Factorization Calculator