Find out the factors of K less than N
sqt = ( int ) ( math . sqrt ( k ) ) NEW_LINE for i in range ( 1 , sqt ) : NEW_LINE INDENT if ( k % i == 0 ) : NEW_LINE INDENT if ( k // i == i and i <= n ) : NEW_LINE INDENT factors . append ( i ) NEW_LINE DEDENT else : NEW_LINE INDENT if ( i <= n ) : NEW_LINE INDENT factors . append ( i ) NEW_LINE DEDENT if ( k // i <= n ) : NEW_LINE INDENT factors . append ( k // i ) NEW_LINE DEDENT DEDENT DEDENT DEDENT return factors NEW_LINE