<> explain ： There are several steps , Each span 2 rank , Last remaining 1 rank , Cross 3 Congruence 2 rank , Cross 5 Congruence 4 rank , Cross 6 Congruence 5 rank , Cross 7 The step just reaches the top of the step .

<> analysis ： First set i, more than 2 be equal to 1, more than 3 be equal to 2, and so on .（ code 1）
i%2 == 1 and i%3 == 2 and i%5 == 4 and i%6 == 5 and i%7 == 0
Meet the above code .

<> The first kind （while determine ）（ code 2）
# Einstein ladder problem i = 1 while i % 2 != 1 or i % 3 != 2 or i % 5 != 4 or i % 6 != 5 or i
% 7 != 0: i+=1 print(i)
<> Go ahead and judge if , If and all do not meet the conditions, it is the number of Einstein steps .

<> The second kind （while determine ）（ code 3）
i=1 while True: # Infinite cycle i+=1 if(i%2==1 and i%3==2 and i%5==4 and i%6==5 and i%7==
0): print(i) break # Jump out of the loop
<>while Infinite recycling if Make a judgment , Qualified output .（ If not break Exit the loop to determine the number of all Einstein steps , But it's an infinite loop !）

<> The third kind （for determine ）（ code 4）
i = 1 for i in range(10000): if (i % 2 == 1 and i % 3 == 2 and i % 5 == 4 and
r i% 6 == 5 and i % 7 == 0): print(i) break
<> The final result is 119

Xiaobai on the road , If you have different opinions , I hope you can have more discussion ! Thank you !!!

Technology
Daily Recommendation