除三余二 除五余三 除七余二,问几何?
#方法一
1 none = True 2 i = 0 3 while none: 4 i +=1 5 if i%3 == 2 and i%5 == 3 and i%7 == 2: 6 print(i) 7 none = False
1 #方法二 2 3 i = 0 4 while True: 5 i +=1 6 if i%3 == 2 and i%5 == 3 and i%7 == 2: 7 print(i) 8 break
补,1000以内有哪些数字满足条件
1 for i in range(1000): 2 if i % 3 == 2 and i % 5 == 3 and i % 7 == 2: 3 print(i) 4 else: 5 continue
结果:
23
128
233
338
443
548
653
758
863
968
转载于:https://www.cnblogs.com/xiaoliangliu86/p/11418374.html