Number Of Factors

Problem Link : http://www.codechef.com/problems/NUMFACT
Need an Efficient Solution !

1 Like
  1. make a function to check if numbers are prime (isPrime()).

  2. divide the given number (in this case the product) by all primes less than that number and find out how many times it repeats for that number.

  3. result = (a1+1).(a2+2)…(ak+1) where ai(1<=i<=k) are counts of all primes below the number.

improvise this for the program. this is just a hint. happy coding !

Yeah Buddy Thanx :slight_smile: . But the solution you are giving surely gives TLE. Bdw you check count of max.number of times a prime divisors appears for each individual number of array and then it will give correct answer.

1 Like