n | def is_nonprime(num): | n | def is_prime(num): |
| """检查一个数是否为非素数""" | | """Определяет, является ли число простым.""" |
| if num <= 1: | | if num <= 1: |
n | return True | n | return False |
| for i in range(2, int(num ** 0.5) + 1): | | for i in range(2, int(num ** 0.5) + 1): |
| if num % i == 0: | | if num % i == 0: |
n | return True | n | return False |
| return False | | return True |
| | | |
| def nonprime(n=0): | | def nonprime(n=0): |
n | """生成大于n的非素数""" | n | """Генератор непростых чисел, превосходящих n.""" |
| current = n + 1 | | current = n + 1 |
| while True: | | while True: |
t | if is_nonprime(current): | t | if not is_prime(current): |
| yield current | | yield current |
| current += 1 | | current += 1 |