4 nouveaux défis
This commit is contained in:
21
Paramétrage du vif d'or.py
Normal file
21
Paramétrage du vif d'or.py
Normal file
@@ -0,0 +1,21 @@
|
||||
def next(x, y, z, n):
|
||||
return y, z, (x+y+z)%n
|
||||
|
||||
if __name__ == "__main__":
|
||||
x0, y0, z0 = 0, 0, 1
|
||||
|
||||
res = {}
|
||||
for n in range(2, 201):
|
||||
x, y, z = x0, y0, z0
|
||||
ctr = 0
|
||||
while True:
|
||||
ctr += 1
|
||||
x, y, z = next(x, y, z, n)
|
||||
if x == x0 and y == y0 and z == z0:
|
||||
print(n, ctr)
|
||||
res[n] = ctr
|
||||
break
|
||||
|
||||
for n in {k: v for k, v in sorted(res.items(), key=lambda item: item[1])}:
|
||||
#print(n, res[n])
|
||||
print(f"{n}, ", end = "")
|
||||
Reference in New Issue
Block a user