number of divisors of n = ( p1 ^ k1 ) * ( p2 ^ k2 ) . . . ( pn ^ kn ) are equal to ( k1 + 1 ) * ( k2 + 1 ) . . . ( kn + 1 ) this function finds the number of divisors of all numbersin range [ 1 , maxn ) and stores it in divisors [ ] divisors [ i ] stores the number of divisors i has
void buildDivisorsArray ( ) { for ( int i = 1 ; i < maxn ; i ++ ) { divisors [ i ] = 1 ; int n = i , p = smallest_prime [ i ] , k = 0 ;