Integer math

Prime Factorization Calculator

Break a positive integer into prime factors and explore its positive divisors.

Enter an integer to factor

Enter 1–999,999,999,999, with up to 12 digits including leading zeros. Grouped commas are accepted. No signs, decimal points, exponents, or expressions.

Prime factorization

Enter a positive integer, then select Calculate.

Exact integer arithmetic in your browser. The divisor preview shows at most 100 values; the count and sum always include all positive divisors.

Worked examples

Repeated factors

Factor 360

360 = 2³ × 3² × 5

Divide by 2 three times: 360 → 180 → 90 → 45. Divide by 3 twice: 45 → 15 → 5. The remaining 5 is prime. There are (3 + 1)(2 + 1)(1 + 1) = 24 positive divisors.

Divisor sum

Explore 28

28 = 2² × 7
(1 + 2 + 4)(1 + 7) = 56

Its positive divisors are 1, 2, 4, 7, 14, and 28. Their sum is 56, including 28 itself. Excluding the input gives the proper divisor sum, 28, but that is a different total.

Prime input

Factor 97

97 = 97

No prime up to √97 divides 97 evenly: 2, 3, 5, and 7 all leave a remainder. Therefore 97 is prime. Its positive divisors are 1 and 97, with count 2 and sum 98.

Method and formulas

The fundamental theorem of arithmetic says that every integer greater than 1 has a unique prime factorization, apart from the order of its factors. This calculator displays primes in ascending order. OpenStax's lesson on prime factorization explains repeated prime division and factor trees.

The calculation divides out 2 and 3 first, then tries possible factors of the remaining integer. Once a candidate's square exceeds the remainder, any remainder above 1 must be prime. This uses exact division and remainder checks, with no rounding.

If n = p₁ᵃ¹ × p₂ᵃ² × … × pₖᵃᵏ for distinct primes, each positive divisor chooses a power from 0 through aᵢ for each prime. Consequently, the positive divisor count is (a₁ + 1)(a₂ + 1)…(aₖ + 1).

The positive divisor sum is (1 + p₁ + … + p₁ᵃ¹) × … × (1 + pₖ + … + pₖᵃᵏ). Expanding the product includes each positive divisor once. Millersville University's divisor function notes (PDF) derive the count and sum formulas.

The input limit is 12 digits, from 1 through 999,999,999,999, with a separate limit of 64 raw characters including spaces and commas. Leading zeros count toward the digit limit. The size limit keeps trial division bounded for browser use. Every divisor is calculated, but only the smallest 100 appear in the expandable preview.

Common questions

Is 1 prime?

No. A prime has exactly two positive divisors, while 1 has only one. This tool accepts 1 and labels it neither prime nor composite. It displays 1 as the product, with no prime factors, and gives positive divisor count 1 and sum 1.

What is the difference between prime factors and divisors?

Prime factors must be prime. Divisors can be prime or composite, and also include 1. For 18, the prime factors are 2 and 3, while the positive divisors are 1, 2, 3, 6, 9, and 18. The repeated factor 3 appears as 3² in the factorization.

Why does the divisor sum include the number itself?

This page uses the sum of all positive divisors, including 1 and the input. A sum of proper positive divisors excludes the input. For example, 6 has divisor sum 1 + 2 + 3 + 6 = 12; its proper divisor sum is 6.

Can I enter zero, negatives, or decimals?

No. Enter one unsigned positive integer. Zero has infinitely many positive divisors, and negative-number conventions are outside this tool's scope. Even a whole-valued decimal such as 12.0 is rejected. Correctly grouped commas such as 12,000 are accepted.

Why are some divisors missing from the preview?

The preview shows the smallest 100 positive divisors when there are more than 100. Its note gives the exact total and how many were omitted. The count and sum above the preview use every divisor, so the preview limit does not change those answers.

Can I use this for numbers larger than 12 digits?

No. This browser tool is designed for bounded integer exercises and everyday factor checks. It rejects larger inputs before factorization. Use a dedicated number-theory tool when you need to factor larger integers.