A positive integer D is a factor of a positive integer N if there exists an integer M such that N = D * M.
For example, 6 is a factor of 24, because M = 4 satisfies the above condition (24 = 6 * 4).
Write a function:
that, given a positive integer N, returns the number of its factors.
For example, given N = 24, the function should return 8, because 24 has 8 factors, namely 1, 2, 3, 4, 6, 8, 12, 24. There are no other factors of 24.
Write an efficient algorithm for the following assumptions:
- N is an integer within the range [1..2,147,483,647].
The solution obtained perfect score.
N <= 10
N=69, N=64, N=120=5!
N=3,628,800=10!, N=5,621,892, N=4,999,696
N=27,043,111, N=39,916,800=11!, N = 39,992,976
N=479,001,600=12!, N=780291637(prime), N=449,991,369
N=1,000,000,000, N=MAX_INT, N=2147,395,600