CalcTrace

Factor Calculator

Enter a whole number to see every number that divides it exactly, the factor pairs, and its prime factorisation in exponent form. The calculator also tells you whether the number is prime, a perfect square or a perfect number, and it handles numbers up to 1,000,000,000,000,000.

Last updated .

Your number

Any whole number from 1 to 1,000,000,000,000,000 (1015). Commas and spaces are ignored.

A factor (also called a divisor) of a number divides it with no remainder. For a negative number the calculator works with the same number without its sign, because the factors are the same apart from sign.

Result

Number of factors

–

–Prime or composite
–Perfect square
–Sum of all factors
–Perfect, abundant or deficient

All factors

    Factor pairs

    PairProduct

    Show the working

      How factors are found

      A factor of a whole number n is a whole number that divides n and leaves no remainder. Factors come in pairs, because if a divides n then n ÷ a divides it too. The quickest route to all of them is the prime factorisation: every whole number above 1 can be written as a product of primes in exactly one way.

      n = p1a₁ × p2a₂ × … × pkaₖ

      Number of factors = (a1 + 1) × (a2 + 1) × … × (ak + 1)

      Sum of factors = (1 + p1 + p1² + … + p1a₁) × … × (1 + pk + … + pkaₖ)

      Here p1 to pk are the different primes that divide n, and a1 to ak are the exponents, meaning how many times each prime appears. Every factor of n is built by choosing, for each prime, a power from 0 up to its exponent. That gives a + 1 choices per prime, which is where the counting formula comes from.

      Worked example: the factors of 360

      1. Divide by the smallest prime that fits, and repeat. 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45. Two no longer divides 45, so move to 3: 45 ÷ 3 = 15, 15 ÷ 3 = 5. Finally 5 ÷ 5 = 1.
      2. Collect the primes. 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5.
      3. Count the factors. The exponents are 3, 2 and 1, so there are (3 + 1) × (2 + 1) × (1 + 1) = 4 × 3 × 2 = 24 factors.
      4. List them in pairs. Start at 1 and work upwards, writing each factor beside its partner: 1 × 360, 2 × 180, 3 × 120, 4 × 90, 5 × 72, 6 × 60, 8 × 45, 9 × 40, 10 × 36, 12 × 30, 15 × 24 and 18 × 20. You can stop at 18 because the next candidate, 19, is past the square root of 360 (about 18.97), and any factor above that has already appeared as the larger half of a pair.
      5. Add them up. (1 + 2 + 4 + 8) × (1 + 3 + 9) × (1 + 5) = 15 × 13 × 6 = 1,170. Leaving out 360 itself, the other factors total 810.

      Prime, composite, perfect and square

      A prime number has exactly two factors, 1 and itself. To test 97 you only need to try primes up to its square root, which is a little under 10: none of 2, 3, 5 or 7 divides 97, so it is prime. A number with more than two factors is composite. The number 1 has a single factor and is neither.

      A perfect square has every exponent even, and it is the only kind of number with an odd count of factors, because the square root pairs with itself. 36 = 2² × 3² has (2 + 1) × (2 + 1) = 9 factors.

      A perfect number equals the sum of its factors other than itself. The first four are 6, 28, 496 and 8,128: for 28 the smaller factors are 1 + 2 + 4 + 7 + 14 = 28. When that sum is larger than the number it is called abundant (360 is, since 810 is more than 360), and when it is smaller the number is deficient. Every prime is deficient because its only smaller factor is 1.

      Large numbers and what limits the method

      The calculator uses trial division, the same method as the worked example, and it never needs to test a divisor larger than the square root of what is left. For a number near 1012 that is at most 1,000,000 candidates, which a phone finishes instantly. The slowest inputs are large primes and products of two large primes, because nothing divides out early. 999,999,999,989 is prime, the largest one below 1012, and so is 1,000,000,007.

      Size alone does not make a number hard. 1012 is 212 × 512, giving 13 × 13 = 169 factors, and it falls apart in a few dozen divisions. 600,851,475,143 looks awkward but splits into 71 × 839 × 1,471 × 6,857, so it has 16 factors.

      Common mistakes

      Forgetting 1 and the number itself

      Both are always factors. A list of the factors of 12 that reads 2, 3, 4, 6 is missing two of the six.

      Mixing up factors and multiples

      Factors divide into a number and are never larger than it. Multiples are what you get by multiplying it, and go on for ever. The factors of 12 are 1, 2, 3, 4, 6 and 12; its multiples are 12, 24, 36 and so on.

      Counting a repeated prime once

      The prime factors of 360 are 2, 3 and 5, but the factorisation is 2³ × 3² × 5. Dropping the exponents gives 2 × 3 × 5 = 30, a different number. The exponents are also what decide how many factors there are: 30 has 8, while 360 has 24.

      Assuming bigger numbers have more factors

      5,040 has 60 factors, yet 5,039, right beside it, is prime and has two. The count depends on how the number breaks into primes, and small primes with large exponents give the most.