Балашов Георгий Сергеевич, 403 группа NonPrime 9415 | Пономаренко Вячеслав Сергеевич, 525 группа NonPrime 8917 | ||||
---|---|---|---|---|---|
t | 1 | from math import sqrt | t | 1 | from math import sqrt |
2 | 2 | ||||
3 | def nonprime(n=0): | 3 | def nonprime(n=0): | ||
4 | if n == 0: | 4 | if n == 0: | ||
5 | yield 1 | 5 | yield 1 | ||
6 | while True: | 6 | while True: | ||
7 | n += 1 | 7 | n += 1 | ||
8 | for i in range(2, int(sqrt(n)) + 1): | 8 | for i in range(2, int(sqrt(n)) + 1): | ||
9 | if n % i == 0: | 9 | if n % i == 0: | ||
10 | yield n | 10 | yield n | ||
11 | break | 11 | break |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|