Finding the number of divisors of n

This turns out to be an application of the multiplication principle for counting things.

For example, suppose we want to count (or find all of) the divisors of n = 144.

Begin by forming the prime factorization of 144:

144 = 24 . 32.

So any divisor of 144 must be a product of some number of 2's (between 0 and 4) and some number of 3's (between 0 and 2). So here's a table of the possibilities:

20 21 22 23 24
30 1 2 4 8 16
31 3 6 12 24 48
32 9 18 36 72 144

From the table, it's easy to see that there are 5 x 3 = 15 divisors of 144.

In general, if you have the prime factorization of the number n, then to calculate how many divisors it has, you take all the exponents in the factorization, add 1 to each, and then multiply these "exponents + 1"s together.