Prime Factorization Calculator
To find the prime factorization of a number, divide it by the smallest prime that fits and repeat with the quotient until only primes are left: 360 = 2³ × 3² × 5 (2 × 2 × 2 × 3 × 3 × 5). That also gives its 24 divisors, which add up to 1170, and Euler’s totient φ(360) = 96. A number is prime when it has no divisors but 1 and itself: 97 is prime, while 91 = 7 × 13. The primes next to 360 are 359 and 367. Enter any whole number up to 30 digits for its factor tree, divisor list and neighbouring primes, or list every prime up to 1,000,000.
Updated Runs in your browser: nothing you enter is uploadedHow this tool works
Prime factorization of 360
2³ × 3² × 5
360 is composite: 2 × 2 × 2 × 3 × 3 × 5, 6 prime factors counting repeats, 3 different.
- Is it prime?
- No, composite
- Prime factorization
- 2³ × 3² × 5
- As a product
- 2 × 2 × 2 × 3 × 3 × 5
- Number of divisors
- 24
- Sum of divisors
- 1170
- Euler’s totient φ(n)
- 96
- Previous prime
- 359
- Next prime
- 367
Factor tree
Each composite number splits into its smallest prime factor and what is left, until only primes remain. The primes at the ends of the branches are the factorization.
The same tree as a list
- 360 splits into
- 2 prime
- 180 splits into
- 2 prime
- 90 splits into
- 2 prime
- 45 splits into
- 3 prime
- 15 splits into
- 3 prime
- 5 prime
Divisors
All 24 divisors of 360, smallest first.
- 1
- 2
- 3
- 4
- 5
- 6
- 8
- 9
- 10
- 12
- 15
- 18
- 20
- 24
- 30
- 36
- 40
- 45
- 60
- 72
- 90
- 120
- 180
- 360
Primes up to N
There are 25 primes up to 100; the largest is 97.
- 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
Prime factorizations of common numbers
| Number | Prime factorization | Divisors | Sum of divisors | Totient φ(n) |
|---|---|---|---|---|
| 12 | 2² × 3 | 6 | 28 | 4 |
| 18 | 2 × 3² | 6 | 39 | 6 |
| 24 | 2³ × 3 | 8 | 60 | 8 |
| 36 | 2² × 3² | 9 | 91 | 12 |
| 48 | 2⁴ × 3 | 10 | 124 | 16 |
| 60 | 2² × 3 × 5 | 12 | 168 | 16 |
| 72 | 2³ × 3² | 12 | 195 | 24 |
| 84 | 2² × 3 × 7 | 12 | 224 | 24 |
| 90 | 2 × 3² × 5 | 12 | 234 | 24 |
| 96 | 2⁵ × 3 | 12 | 252 | 32 |
| 100 | 2² × 5² | 9 | 217 | 40 |
| 120 | 2³ × 3 × 5 | 16 | 360 | 32 |
| 144 | 2⁴ × 3² | 15 | 403 | 48 |
| 180 | 2² × 3² × 5 | 18 | 546 | 48 |
| 210 | 2 × 3 × 5 × 7 | 16 | 576 | 48 |
| 360 | 2³ × 3² × 5 | 24 | 1170 | 96 |
| 720 | 2⁴ × 3² × 5 | 30 | 2418 | 192 |
| 1000 | 2³ × 5³ | 16 | 2340 | 400 |
| 1024 | 2¹⁰ | 11 | 2047 | 512 |
| 2025 | 3⁴ × 5² | 15 | 3751 | 1080 |
Numbers with many divisors
| Number | Prime factorization | Divisors |
|---|---|---|
| 12 | 2² × 3 | 6 |
| 60 | 2² × 3 × 5 | 12 |
| 360 | 2³ × 3² × 5 | 24 |
| 5,040 | 2⁴ × 3² × 5 × 7 | 60 |
| 55,440 | 2⁴ × 3² × 5 × 7 × 11 | 120 |
| 720,720 | 2⁴ × 3² × 5 × 7 × 11 × 13 | 240 |
Miller–Rabin witness sets used for the prime test
| Proven for n below | Witnesses (first primes) | How many |
|---|---|---|
| 2,047 | 2 | 1 |
| 1,373,653 | 2, 3 | 2 |
| 25,326,001 | 2, 3, 5 | 3 |
| 3,215,031,751 | 2, 3, 5, 7 | 4 |
| 2,152,302,898,747 | 2, 3, 5, 7, 11 | 5 |
| 3,474,749,660,383 | 2, 3, 5, 7, 11, 13 | 6 |
| 341,550,071,728,321 | 2, 3, 5, 7, 11, 13, 17 | 7 |
| 3,825,123,056,546,413,051 | 2, 3, 5, 7, 11, 13, 17, 19, 23 | 9 |
| 318,665,857,834,031,151,167,461 | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 | 12 |
| 3,317,044,064,679,887,385,961,981 | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 | 13 |
| 3,317,044,064,679,887,385,961,981 and up | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 | 20 (probable prime) |
How to find the prime factorization of a number by hand
- Divide by the smallest prime that goes in. Try 2, then 3, 5, 7 and so on. 360 is even, so divide by 2: 360 ÷ 2 = 180. Keep dividing by the same prime while it still goes in: 180 ÷ 2 = 90, 90 ÷ 2 = 45.
- Move to the next prime when it stops going in. 45 is odd, so try 3: 45 ÷ 3 = 15 and 15 ÷ 3 = 5. Then 5 is prime and the division ends.
- Stop when the square of the prime passes what is left. You only need to try primes p with p × p no larger than the remaining number; if none goes in, what is left is prime. This is why 97 is prime: no prime up to 9 divides it.
- Collect the primes and write exponents. The primes you divided out are 2, 2, 2, 3, 3 and 5, so 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5. Draw the same split as a factor tree if you want a picture.
- Get the divisor count from the exponents. Add 1 to each exponent and multiply: (3 + 1)(2 + 1)(1 + 1) = 24 divisors of 360.
Frequently asked questions
- What is prime factorization?
- It is writing a whole number greater than 1 as a product of primes. By the fundamental theorem of arithmetic every such number has exactly one prime factorization, apart from the order of the factors. 360 = 2³ × 3² × 5, and no other set of primes multiplies to 360.
- How do I know if a number is prime?
- A prime has exactly two divisors, 1 and itself. To check by hand, divide by every prime whose square is no more than the number: 97 has no divisor among 2, 3, 5 and 7, so it is prime, while 91 = 7 × 13 is not. The calculator uses the Miller–Rabin test, which is proven correct for every number below 3,317,044,064,679,887,385,961,981.
- Is 1 a prime number?
- No. A prime has exactly two divisors, and 1 has only one. Calling 1 prime would also break the uniqueness of prime factorization, because 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3 and so on. 1 is neither prime nor composite; it is the empty product.
- What is a factor tree?
- A diagram that splits a number into two factors, then splits each composite factor again until every branch ends in a prime. Here 360 splits into 2 and 180, then 180 into 2 and 90, and so on to the leaves 2, 2, 2, 3, 3 and 5. The tool always splits off the smallest prime, so the tree has one shape for each number. The drawing has a text description and the same tree is given as a nested list for screen readers.
- How do I count the divisors of a number?
- Factor it, add 1 to each exponent and multiply. 60 = 2² × 3 × 5, so it has (2 + 1)(1 + 1)(1 + 1) = 12 divisors. The sum of the divisors is the product of (p^(e+1) − 1)/(p − 1) for each prime power: 60 gives 168. 12 has 6 divisors adding up to 28.
- What is Euler’s totient function?
- φ(n) counts the numbers from 1 to n that share no factor with n. From the factorization, φ(n) = n × the product of (1 − 1/p) over the distinct primes p. For 36 = 2² × 3² that is 36 × 1/2 × 2/3 = 12. For a prime p, φ(p) = p − 1: φ(97) = 96. It is used in RSA key generation and in modular arithmetic.
- How does it find the factors of a big number?
- It divides out every prime below 10,000 first, then tests what is left for primality with Miller–Rabin and, if it is composite, uses Pollard’s rho algorithm (Brent’s variant) to find a factor. That factors a number like 600851475143 = 71 × 839 × 1471 × 6857 instantly. Everything runs in a background thread in your browser, so the page stays responsive.
- Why does it say “too hard to factor here” for some numbers?
- Pollard’s rho takes about the square root of the smallest prime factor in steps, so a number made of two primes of about 14 digits each needs about ten million big-number steps. The tool gives each number a few seconds and then shows what it found so far. Numbers like that are exactly what RSA relies on being hard to factor; serious factoring uses methods such as the quadratic or number field sieve on many machines.
- Is a very large result really prime?
- Below 3,317,044,064,679,887,385,961,981 (about 3.3 × 10²⁴) the answer is proven, because the Miller–Rabin witness sets are known to have no exceptions there. Above that the tool tests 20 prime bases and labels a passing number “probable prime”: no number is known that passes all of them and is composite, but there is no proof. Composite answers are always certain, since a single failing witness proves a number composite.
- How many primes are there up to 100 and up to 1,000,000?
- There are 25 primes up to 100 and 78,498 up to 1,000,000, the largest of them being 999,983. The “Primes up to N” list uses the Sieve of Eratosthenes, which crosses out the multiples of each prime in turn, and shows the first 1,000 primes.
- Which numbers are the next and previous prime?
- They are the closest primes above and below the number you enter. For 360 they are 367 and 359. Prime gaps grow slowly (about the number of digits times 2.3 on average), so the search is quick even for 30-digit numbers.
- How do I use prime factors to find the GCD or LCM?
- Write both numbers in exponent form: 18 = 2 × 3² and 24 = 2³ × 3. The GCD takes each shared prime to the smaller exponent (2 × 3 = 6) and the LCM takes every prime to the larger exponent (2³ × 3² = 72).
How it works
The number is read as a whole number of up to 30 digits and held as a BigInt, so there is no rounding. Primality uses the Miller–Rabin strong probable-prime test with fixed witnesses: for n below 3,317,044,064,679,887,385,961,981 the witness sets from OEIS A014233 (Jaeschke 1993; Sorenson & Webster 2015) make the test deterministic, and above that bound the first 20 primes are tried and a pass is reported as a probable prime. Factoring divides out every prime below 10,000, then splits what remains with Pollard’s rho in Brent’s variant (pseudo-random map x² + c, cycle detection by Brent’s method, gcds taken in batches of 128 steps), recursing until every piece passes the primality test; perfect squares are split by an integer square root. Each number gets a time budget of a few seconds; if factoring does not finish, the tool shows the factors found and the unfactored remainder. The divisor count is the product of (e + 1), the divisor sum the product of (p^(e+1) − 1)/(p − 1), and φ(n) the product of p^(e−1)(p − 1). Next and previous primes are found by testing the odd numbers above and below. “Primes up to N” is the Sieve of Eratosthenes for N up to 1,000,000; the count is exact and at most 1,000 primes are listed. Everything runs in your browser and nothing you type is sent anywhere.
Sources
- A014233: smallest odd numbers for which Miller–Rabin with the first n prime bases fails, OEIS
- Sorenson & Webster, Strong pseudoprimes to twelve prime bases (2015)
- Brent, An improved Monte Carlo factorization algorithm, BIT 20 (1980)
- Miller–Rabin primality test, Wikipedia
- Fundamental theorem of arithmetic, Encyclopaedia Britannica
- Pollard’s rho algorithm, Wikipedia
More free tools
- Fraction CalculatorAdd, subtract, multiply and divide fractions and mixed numbers like 2 3/8 + 1 5/16, simplify, and convert to decimals, with every step shown.
- Number Base ConverterConvert whole numbers between binary, octal, decimal, hex and any base from 2 to 36, up to 5,000 digits, with grouped digits and a two’s-complement view.
- Scientific Notation ConverterConvert any number to scientific, E and engineering notation or back to standard form, round to significant figures, and count the sig figs you typed.
- Average CalculatorPaste a list of numbers and get the mean, median, mode, range, sum, count and standard deviation, plus a weighted average, with the working shown.
- Number to Words ConverterConvert numbers to English words, check amounts and ordinals, or words back to digits. Exact up to 66 digits, with optional British “and”.
- Decimal to Fraction ConverterTurn a decimal like 0.375 or 0.1(6) into an exact fraction, or round inches to the nearest 1/16 or 1/32 on a tape measure, with the working shown.