Count Divisors of n in O ( n ^ 1 / 3 ) | function to count the divisors ; If divisors are equal , count only one ; else Otherwise count both ; Driver Code
function countDivisors ( n ) { let cnt = 0 ; for ( let i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) cnt ++ ; cnt = cnt + 2 ; } } return cnt ; } document . write ( " " + " " + countDivisors ( 100 ) ) ;