Find all divisors of first N natural numbers | Function to find the factors of the numbers from 1 to N ; Loop to find the factors of the first N natural numbers of the integer ; Driver Code
def factors ( n ) : NEW_LINE INDENT print ( "1 ▁ - - > 1" ) ; NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT print ( i , " ▁ - - > " , end = " " ) ; NEW_LINE for j in range ( 1 , int ( pow ( i , 1 ) ) ) : NEW_LINE INDENT if ( i % j == 0 ) : NEW_LINE INDENT print ( j , " , ▁ " , end = " " ) ; NEW_LINE if ( i // j != j ) : NEW_LINE INDENT print ( i // j , " , ▁ " , end = " " ) ; NEW_LINE DEDENT DEDENT DEDENT print ( end =   " " ) ; NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 5 ; NEW_LINE factors ( n ) ; NEW_LINE DEDENT