Factors of a Number Calculator (All Divisors)

Enter a whole number and this calculator lists every divisor, pairs them up, and reports the two functions number theorists care about: d(n), how many divisors there are, and σ(n), what they add up to. Both come from the prime factorisation rather than from counting, which is why the answer is instant even for large inputs. Subtracting the number from its own divisor sum tells you whether it is deficient, perfect or abundant — the classification the Greeks invented and that still has open problems attached to it.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Whole number nA positive integer. Decimals are rounded, since divisibility is only defined for whole numbers.360

It returns

  • Number of divisors d(n) — Counting 1 and n themselves.
  • Sum of all divisors σ(n)
  • Sum of the proper divisors — σ(n) minus n itself — everything that divides n except n.
  • Classification — Deficient, perfect or abundant, decided by comparing the proper divisor sum with n.
  • Prime factorisation — The unique product of primes that gives n.
  • Divisors — Listed in increasing order; long lists are truncated.

The formula

d(n)=(ei+1), σ(n)=piei+11pi1
σ(n)=2n

In plain text: For n = p₁^e₁ · p₂^e₂ ⋯ : d(n) = Π(eᵢ + 1) and σ(n) = Π (pᵢ^(eᵢ+1) − 1)/(pᵢ − 1)

  • nThe positive integer being factored (integer)
  • pᵢThe distinct prime factors of n (prime)
  • eᵢThe exponent each prime carries in the factorisation (integer)
  • d(n)How many positive divisors n has, including 1 and n (count)
  • σ(n)The sum of all positive divisors of n (integer)

Both formulas are multiplicative: they run over the prime factorisation, so they need no list of divisors to evaluate. A perfect number satisfies σ(n) = 2n.

Updated Category Number Theory, Divisors & Number Systems Verified against published test cases Reading time 10 min

Divisors, factors and the pairing that halves the work

A divisor of n is a whole number that divides it leaving no remainder. Factor and divisor mean the same thing here; the words differ only in emphasis, with “factor” suggesting the multiplication that builds n and “divisor” the division that tests it.

Divisors come in pairs. If a divides n, then b = n/a is a whole number and divides n too, and the pair multiplies back to n. That observation is worth more than it looks. In each pair, one member is at most √n and the other is at least √n — if both were larger than the square root their product would exceed n. So to find every divisor you only need to test candidates up to √n and read off each partner by division. For n = 360 that means testing 18 candidates rather than 360, and for a twelve-digit number it means a million tests rather than a trillion.

Only a perfect square has a divisor that pairs with itself: 36 pairs 6 with 6. That is why perfect squares are the only numbers with an odd divisor count, a fact with a well-known consequence — the locker problem, in which each locker is toggled once per divisor, leaves exactly the square-numbered lockers open.

Two divisors are guaranteed for every n greater than 1: the number 1 and n itself. These are called improper or trivial divisors. A number whose only divisors are those two is prime, which is why the divisor count of a prime is exactly 2 and why the prime checker is really asking the same question this calculator answers.

Counting and summing the divisors without listing them

Listing divisors by trial division is fine for small numbers and hopeless for large ones. The efficient route goes through the prime factorisation, and it produces both the count and the sum directly.

Write n as a product of prime powers, say 360 = 2³ × 3² × 5¹. Every divisor of n is built by choosing an exponent for each prime, independently, anywhere from 0 up to the exponent in n. For 360 you choose the power of 2 from {0,1,2,3}, the power of 3 from {0,1,2}, and the power of 5 from {0,1}. That is 4 × 3 × 2 = 24 combinations, and each one gives a different divisor because factorisations are unique. Hence

d(n) = (e₁ + 1)(e₂ + 1)⋯

The divisor sum comes from the same construction. Multiply out the product

(1 + 2 + 4 + 8)(1 + 3 + 9)(1 + 5)

and every term of the expansion is exactly one divisor of 360, each appearing once. So the product of those sums is σ(360) = 15 × 13 × 6 = 1,170. Each bracket is a geometric series, which closes to

σ(n) = ∏ (pᵢeᵢ+1 − 1) / (pᵢ − 1)

Both functions are multiplicative: if a and b share no common factor, then d(ab) = d(a)d(b) and σ(ab) = σ(a)σ(b). The coprimality condition is essential. d(4) = 3 and d(6) = 4, but d(24) = 8, not 12, because 4 and 6 share a factor of 2. Getting the prime factorisation right is therefore the whole job; everything else is bookkeeping.

Worked example: every factor of 360

Step 1 — factorise. Divide out the small primes in turn: 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45, and 45 is odd. Then 45 ÷ 3 = 15, ÷ 3 = 5, and 5 is prime. So

360 = 2³ × 3² × 5

Step 2 — count. The exponents are 3, 2 and 1, so d(360) = (3+1)(2+1)(1+1) = 4 × 3 × 2 = 24 divisors.

Step 3 — sum. Apply the geometric-series form to each prime:

  • For 2³: (2⁴ − 1) ÷ (2 − 1) = 15 ÷ 1 = 15. Check by addition: 1 + 2 + 4 + 8 = 15. ✓
  • For 3²: (3³ − 1) ÷ (3 − 1) = 26 ÷ 2 = 13. Check: 1 + 3 + 9 = 13. ✓
  • For 5¹: (5² − 1) ÷ (5 − 1) = 24 ÷ 4 = 6. Check: 1 + 5 = 6. ✓

So σ(360) = 15 × 13 × 6 = 1,170.

Step 4 — classify. The proper divisor sum is 1,170 − 360 = 810, which is more than 360, so 360 is abundant — and comfortably so, at 2.25 times its own size.

Step 5 — list them by pairing. Test each candidate up to √360 ≈ 18.97, so up to 18, and read off the partner:

1×360, 2×180, 3×120, 4×90, 5×72, 6×60, 8×45, 9×40, 10×36, 12×30, 15×24, 18×20.

Twelve pairs, twenty-four divisors, matching d(360) exactly — which is the check that no candidate was missed. Note that 7, 11, 13, 14, 16 and 17 are absent because none divides 360, and that 360 is not a perfect square, so no divisor pairs with itself and the count is even.

What the divisor count and divisor sum tell you

A high divisor count means the number is flexible. This is not idle: 60 has twelve divisors while the nearby 59 has two, which is exactly why an hour has 60 minutes and a circle 360 degrees. Both can be divided into halves, thirds, quarters, fifths, sixths and more without fractions. Numbers with more divisors than any smaller number are called highly composite, and 360 is one of them.

The classification compares σ(n) − n against n. Deficient means the proper divisors fall short, perfect means they hit it exactly, abundant means they overshoot. Every prime is maximally deficient, with a proper divisor sum of 1. Every multiple of a perfect number other than the number itself is abundant, and every multiple of an abundant number is abundant, which is why abundance spreads: the smallest abundant number is 12, and abundant numbers make up roughly a quarter of all integers.

Perfect numbers are rare and structured. Euclid proved that if 2p − 1 is prime then 2p−1(2p − 1) is perfect, which generates 6, 28, 496, 8128 and onward; Euler proved every even perfect number has that form. Whether any odd perfect number exists is still open after more than two thousand years, and it is one of the oldest unsolved problems in mathematics.

Do not read the divisor sum as a measure of size. σ(n) grows irregularly, jumping high at highly composite numbers and sitting at n + 1 for every prime. A number with a large σ is not a large number; it is a number with a rich factorisation.

Divisor count, divisor sum and classification for representative numbers

d(n) is the product of the exponents each increased by one; σ(n) is the product of the corresponding geometric series. The classification compares σ(n) − n against n.
nPrime factorisationd(n)σ(n)σ(n) − nClass
62 × 34126Perfect
122² × 362816Abundant
162⁴53115Deficient
282² × 765628Perfect
362² × 3²99155Abundant
602² × 3 × 512168108Abundant
97972981Deficient
1002² × 5²9217117Abundant
3602³ × 3² × 5241170810Abundant
4962⁴ × 3110992496Perfect

16 and 36 both have an odd divisor count because they are perfect squares, and their middle divisor pairs with itself. 6, 28 and 496 are the first three perfect numbers, each of the form 2^(p−1)(2^p − 1) with the second factor prime.

Mistakes and misunderstandings about factors

  • Confusing factors with prime factors. 360 has 24 divisors but only three distinct prime factors. The prime factorisation is the recipe; the divisor list is everything you can build from it.
  • Forgetting 1 and n. Both are divisors. Excluding them gives the proper divisors, and the two conventions differ by 1 and by n, which is exactly the difference between the divisor sum and the classification test.
  • Applying multiplicativity to numbers that share a factor. d(ab) = d(a)d(b) holds only when a and b are coprime. d(4)d(6) = 12, but d(24) = 8.
  • Searching past the square root. Every divisor above √n already appeared as the partner of one below it. Testing beyond the square root doubles the work and finds nothing new.
  • Assuming an even divisor count. Perfect squares have an odd one, because their square root pairs with itself.
  • Treating 1 as prime. It has one divisor, not two, so it is neither prime nor composite. Making it prime would break the uniqueness of factorisation, since 12 could then be written 2²×3, 1×2²×3, 1²×2²×3 and so on.

Where divisor lists get used

Simplifying fractions needs the largest divisor two numbers share. Rather than listing all factors of both and intersecting, use Euclid's algorithm — the greatest common factor calculator does this in a handful of steps regardless of how large the numbers are, which is why it beats factorisation for that job.

Finding a common denominator needs the least common multiple, which takes the highest power of each prime rather than the lowest. The identity gcd(a,b) × lcm(a,b) = ab links the two, so either one gives the other by a single division.

Arranging things in rectangles is a factor-pair problem in disguise. The number of distinct rectangular arrangements of n objects is the number of factor pairs, which is d(n)/2 rounded up. Thirty-six chairs can be set out in five ways (1×36, 2×18, 3×12, 4×9, 6×6) because d(36) = 9.

Cryptography depends on factoring being hard. Every method here works by finding small factors, and that is exactly why RSA keys are built from two large primes: a number with no small factors defeats trial division, and no fast general method is known. The divisor count of an RSA modulus is 4, which is the whole point — the difficulty is not in counting the divisors but in finding them.

Finally, if what you actually want is the remainder rather than the divisors, the long division calculator shows the working, and the modulo calculator reduces it to the residue that modular arithmetic uses.

Frequently asked questions

How many factors does 360 have?

Twenty-four. Because 360 = 2³ × 3² × 5, every divisor is built by choosing a power of 2 from four options, a power of 3 from three, and a power of 5 from two: 4 × 3 × 2 = 24. They pair up into twelve factor pairs, from 1×360 up to 18×20, which is the check that none has been missed. Their sum is 1,170.

Do 1 and the number itself count as factors?

Yes, under the standard definition. Both divide n with no remainder, so both are divisors, and d(n) counts them. When you exclude n itself you get the proper divisors, which is the set used to classify a number as deficient, perfect or abundant. Be explicit about which convention a question means, because it changes the answer by n.

Why do I only need to test up to the square root?

Because divisors come in pairs whose product is n, and in every pair one member is at most √n. If both were larger their product would exceed n, which is impossible. So testing candidates up to the square root finds the smaller member of every pair, and dividing gives you the larger one for free. For a twelve-digit number that is a million tests instead of a trillion.

What makes a number perfect, abundant or deficient?

The comparison between its proper divisor sum and itself. Add every divisor except the number: less than n is deficient, equal to n is perfect, more than n is abundant. 28 is perfect because 1+2+4+7+14 = 28. 12 is abundant because 1+2+3+4+6 = 16. Every prime is deficient with a proper sum of exactly 1, and the smallest abundant number is 12.

What is σ(n) and why is it useful?

Sigma is the sum-of-divisors function, and it is useful because it is multiplicative: σ(ab) = σ(a)σ(b) whenever a and b are coprime, so it can be computed straight from the prime factorisation without listing anything. That makes it the natural way to test for perfection — n is perfect exactly when σ(n) = 2n — and it appears throughout analytic number theory for the same structural reason.

Which numbers have an odd number of factors?

Only the perfect squares. Divisors normally pair off, giving an even count, but a square's root pairs with itself and is counted once. 36 has nine divisors because 6 × 6 uses the same number twice. This is the resolution of the classic locker puzzle, where each locker is toggled once per divisor and only the square-numbered ones end up open.

Is 1 a prime number?

No. A prime has exactly two distinct divisors, and 1 has only one. The convention is not arbitrary: if 1 were prime, factorisations would stop being unique, since 12 could be written as 2²×3 or 1×2²×3 or 1¹⁰×2²×3, and the fundamental theorem of arithmetic would have to be restated with an exception on every line.

Do negative numbers have factors?

They do in ring theory, where −12 is divisible by ±1, ±2, ±3, ±4, ±6 and ±12, but elementary number theory restricts attention to positive divisors because the negative ones are just sign copies and carry no extra information. This calculator takes positive integers only. Zero is a separate case: every non-zero integer divides it, so its divisor list is infinite and σ(0) is undefined.

References