Романтовский Александр 522 NonPrime 9624 | Воробьев Сергей Юрьевич 530 NonPrime 10242 | ||||
---|---|---|---|---|---|
f | 1 | def is_prime(num): | f | 1 | def is_prime(num): |
n | 2 | if num <= 1: | n | 2 | if num < 2: |
3 | return False | 3 | return False | ||
4 | if num == 2: | 4 | if num == 2: | ||
5 | return True | 5 | return True | ||
6 | if num % 2 == 0: | 6 | if num % 2 == 0: | ||
7 | return False | 7 | return False | ||
8 | for i in range(3, int(num ** 0.5) + 1, 2): | 8 | for i in range(3, int(num ** 0.5) + 1, 2): | ||
9 | if num % i == 0: | 9 | if num % i == 0: | ||
10 | return False | 10 | return False | ||
11 | return True | 11 | return True | ||
12 | 12 | ||||
13 | def nonprime(n=0): | 13 | def nonprime(n=0): | ||
n | 14 | num = n + 1 | n | 14 | i = n + 1 |
15 | while True: | 15 | while True: | ||
t | 16 | if not is_prime(num): | t | 16 | if not is_prime(i): |
17 | yield num | 17 | yield i | ||
18 | num += 1 | 18 | i += 1 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|