Just to clarify pka's excellent answer, and specifically taking the example of 2520
It has the following PRIME Factors : 2 x 2 x 2 x 3 x 3 x 5 x 7
= 2
3 x 3
2 x 5 x 7
You can determine ALL factors of 2520 by taking the Cartesian product of the sets of the powers (0..N) of each prime factor
{2
0,2
1,2
2,2
3}
{3
0,3
1,3
2}
{5
0,5
1}
{7
0,7
1}
Removing the powers, leaves the following sets:
{1,2,4,8}
{1,3,9}
{1,5}
{1,7}
You now need to do the fairly tedious exercise of multiplying out each combination of one number from each set with one of each value of every other set:
1 x 1 x 1 x 1, 2 x 1 x 1 x 1, 4 x 1 x 1 x 1, 8 x 1 x 1 x 1, .... 8 x 9 x 5 x 7
Which yields the 48 factors:
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 12 , 14 , 15 , 18 , 20 , 21 , 24 , 28 , 30 , 35 , 36 , 40 , 42 , 45 , 56 , 60 , 63 , 70 , 72 , 84 , 90 , 105 , 120 , 126 , 140 , 168 , 180 , 210 , 252 , 280 , 315 , 360 , 420 , 504 , 630 , 840 , 1260 , 2520
Note that since your question requires just the NUMBER of factors, you can just multiply the number of values in each set together, viz, from this step:
{2
0,2
1,2
2,2
3}
{3
0,3
1,3
2}
{5
0,5
1}
{7
0,7
1}
(this was pka's point about (3 + 1)(2 + 1)(1 + 1)(1 + 1))
The number of factors is simply:
4 x 3 x 2 x 2 = 48
(you can double check your prime factorization from a site like
http://statsfiddle.info/Primes/PrimeFactors/2520)