Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- n = int(input())
- def isInt(n):
- return int(n) == float(n)
- def MinDivisor(n):
- d = 2
- sqr = math.sqrt(n)
- if isInt(sqr):
- for d in range(d, n-1):
- if n % d == 0:
- return d
- if d > sqr:
- return d
- d += 1
- return d
- else:
- for d in range(d, n-1):
- if n % d == 0:
- return d
- d += 1
- return d
- if MinDivisor(n) == n-1:
- print(n)
- else:
- print(MinDivisor(n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement