MaxPrime/Stephan | MaxPrime/valerapon | ||||
---|---|---|---|---|---|
n | 1 | def prime(a): | n | 1 | def isPrime(num): |
2 | for x in range(2, int(a**0.5)+1): | 2 | for i in range(2, round(num ** 0.5) + 2): | ||
3 | if a % x == 0: | 3 | if num % i == 0: | ||
4 | return False | 4 | return False | ||
n | 5 | n | |||
6 | return True | 5 | return True | ||
7 | 6 | ||||
8 | 7 | ||||
n | 9 | n = int(input()) | n | 8 | num = int(input()) |
10 | 9 | ||||
n | 11 | while not prime(n): | n | 10 | while not isPrime(num): |
12 | n -= 1 | 11 | num -= 1 | ||
12 | print(num) | ||||
13 | 13 | ||||
t | 14 | print(n) | t | ||
15 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|