number of divisors of n = ( p1 ^ k1 ) * ( p2 ^ k2 ) . . . ( pn ^ kn ) are equal to ( k1 + 1 ) * ( k2 + 1 ) . . . ( kn + 1 ) . This functionfinds the number of divisors of all numbersin range [ 1 , maxn ) and stores it in divisors [ ] divisors [ i ] stores the number of divisors i has
def buildDivisorsArray ( ) : NEW_LINE INDENT for i in range ( 1 , maxn ) : NEW_LINE INDENT divisors [ i ] = 1 NEW_LINE n = i NEW_LINE p = smallest_prime [ i ] NEW_LINE k = 0 NEW_LINE DEDENT DEDENT