If you do the factorization properly it will not TL.
So first find all primes in the range [2, sqrt(n) ] using
http://en.wikipedia.org/wiki/Sieve_of_Eratosthene.
Now you have to find the number of the divisors of n, then count the divisors of the form x^2, x^3,..., x^k(where x divides n), and add them
to the total sum. Think for a while, how to count the divisors of the form
x, x^2, x^3....,x^3(where x divides n) when having n factorized.
If n = p1^q1*p2^q2*...*ps^qs, the number of the divisors is
(q1+1)*(q2+1)*...*(qs+1) ( I presume you now where this come from)
I will show you how to find divisors of the form x^2(where x divides n),
and for x^k just develop this idea further.
So x divides n => x=p1^r1*p2^r2*....ps^rs, for some ri in the range
[0,qi] => x^2 = p1^(r1*2)*p2^(r2*2)*...*ps^(rs*2). Now consider the
prime factor pi, it can participate in the products of this type in exactly
1+qi/2 different ways : pi^0, pi^2, pi^4..... pi^(i/2), now using the same
logic as in counting the number of different divisors you will find that the
number is (1+q1/2)*(1+q2/2)*(1+q3/2)*...*(1+qs/2)
*sorry if my English contains errors
![;)](./images/smilies/icon_wink.gif)