http://en.wikipedia.org/wiki/Divisor_function

to calc number of divisors of X:

  1. found all prime factors of X and number of each factors: X = f1^a1 * f2^a2 * f3^a3 ……
  2. number of divisors = (a1 + 1) * (a2 + 1) * (a3 + 1) * …