4 nouveaux défis

This commit is contained in:
2022-10-09 22:21:01 +02:00
parent 3b054d370c
commit 34b88066f0
4 changed files with 86 additions and 0 deletions

View 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 = "")