Абуд Халед Набиль, 522 группа NonPrime 9662 | Константин Болотин, 528 NonPrime 9903 | ||||
---|---|---|---|---|---|
f | 1 | from math import sqrt | f | 1 | from math import sqrt |
2 | 2 | ||||
n | 3 | def check_prime(x): | n | 3 | def isprime(n): |
4 | if x < 3: | 4 | if n <= 1: | ||
5 | return True | 5 | return False | ||
6 | for i in range(2, int(sqrt(x)) + 1): | 6 | for i in range(2, int(sqrt(n)) + 1): | ||
7 | if x % i == 0: | 7 | if n % i == 0: | ||
8 | return False | 8 | return False | ||
9 | return True | 9 | return True | ||
10 | 10 | ||||
11 | def nonprime(n=0): | 11 | def nonprime(n=0): | ||
n | 12 | i = n + 1 | n | 12 | current = n + 1 |
13 | while True: | 13 | while True: | ||
t | 14 | if i == 1 or not check_prime(i): | t | 14 | if current == 1 or not isprime(current): |
15 | yield i | 15 | yield current | ||
16 | i += 1 | 16 | current += 1 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|