to compute least prime divisor of i
def preCompute ( ) : NEW_LINE INDENT lpd [ 0 ] , lpd [ 1 ] = 1 , 1 NEW_LINE for i in range ( 2 , mt . ceil ( mt . sqrt ( MAX ) ) ) : NEW_LINE INDENT for j in range ( 2 * i , MAX , i ) : NEW_LINE INDENT if ( lpd [ j ] == 0 ) : NEW_LINE INDENT lpd [ j ] = i NEW_LINE DEDENT DEDENT DEDENT for i in range ( 2 , MAX ) : NEW_LINE INDENT if ( lpd [ i ] == 0 ) : NEW_LINE INDENT lpd [ i ] = i NEW_LINE DEDENT DEDENT DEDENT