number theory calculators

Divisor Count Calculator

Count exactly how many divisors a positive integer has, including 1 and itself. Useful for number theory, factorization analysis, and competition math.

About this calculator

The number of divisors of n, written τ(n) or d(n), counts every positive integer that divides n without remainder, including 1 and n itself. The efficient algorithm tests all integers i from 1 to √n: if i divides n and i ≠ n/i, it contributes two divisors (i and n/i); if i = n/i (n is a perfect square), it contributes one. Using prime factorization, if n = p₁^a₁ × p₂^a₂ × … then τ(n) = (a₁ + 1)(a₂ + 1)…. For example, 12 = 2² × 3¹ has τ(12) = (2+1)(1+1) = 6 divisors: 1, 2, 3, 4, 6, 12. Highly composite numbers are integers with more divisors than any smaller integer, and they appear frequently in scheduling and music theory.

How to use

Enter n = 36. The calculator checks i from 1 to 6 (since √36 = 6). Pairs found: (1, 36), (2, 18), (3, 12), (4, 9), (6, 6). The pair (6, 6) is a perfect square case contributing 1; the other four pairs contribute 2 each. Total: 4 × 2 + 1 = 9 divisors: {1, 2, 3, 4, 6, 9, 12, 18, 36}. Type any positive integer and the calculator returns the count instantly.

Frequently asked questions

How do you find the number of divisors using prime factorization?

Express n as a product of prime powers: n = p₁^a₁ × p₂^a₂ × … × pₖ^aₖ. The total divisor count is τ(n) = (a₁ + 1)(a₂ + 1) × … × (aₖ + 1). Each exponent aᵢ can independently range from 0 to aᵢ, giving aᵢ + 1 choices per prime. For n = 72 = 2³ × 3², τ(72) = (3+1)(2+1) = 12. This multiplicative formula is much faster than trial division for numbers with known factorizations.

What is the difference between proper divisors and all divisors?

All divisors of n include every integer from 1 to n that divides n evenly, including n itself. Proper divisors exclude n, containing only the smaller factors. For example, the divisors of 6 are {1, 2, 3, 6}, while the proper divisors are {1, 2, 3}. The sum of proper divisors is used to classify numbers as perfect, abundant, or deficient. This calculator counts all divisors by default.

Why do perfect squares always have an odd number of divisors?

Divisors of n naturally pair up as (d, n/d). When n is a perfect square, the square root √n pairs with itself rather than a distinct partner, contributing an unpaired divisor. All other pairs contribute two divisors each, making the total an even number plus one — always odd. For example, 36 has 9 divisors. Non-square integers have all divisors in distinct pairs, so their count is always even. This is a quick primality-adjacent check: if τ(n) is odd, n is a perfect square.