Find all the prime factors and their powers
while ( N > 1 ) { N = Math . floor ( N / s [ N ] ) ; if ( N != 0 && s [ N ] != 0 ) if ( ! cnt . has ( s [ N ] ) ) cnt . set ( s [ N ] , 1 ) ; else cnt . set ( s [ N ] , cnt . get ( s [ N ] ) + 1 ) ; } if ( cnt . has ( 0 ) ) cnt . delete ( 0 ) ; let totfactor = 1 ; for ( i of cnt . values ( ) ) totfactor *= i + 1 ;