题解 | 小红的合数寻找
小红的合数寻找
https://www.nowcoder.com/practice/2a35a6306f204ea3ab76ff10d188ff9e
while True:
try:
num = int(input())
zhishu_list = []
heshu_list = []
for i in range(num, 2*num+1):
count = 0
for j in range(1, i+1):
if i % j == 0:
count += 1
if count == 2:
zhishu_list.append(i)
# print(zhishu_list)
for n in range(num, 2*num+1):
if n > 1 and n not in zhishu_list:
heshu_list.append(n)
# print(heshu_list)
if heshu_list:
print(heshu_list[0])
else:
print(-1)
except Exception as e:
break

