generate functionThu, 09 Mar 2023

The program receives a natural number n > 1 as input. Print the minimum divisor of this number that is different from one.

def min_divisor(n): if n == 2: return 2 else: for i in range(2, n+1): if n % i == 0: return i break min_divisor(10)

Questions about programming?Chat with your personal AI assistant