前几天在Youtube上 看到了很多数学家都struggle于这个问题的证明上
为此 我写了一个程序来验证考拉兹定理
So 什么是Collatz Conjecture?
代码:
from random import choice
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.set_xlabel("number")
ax.set_ylabel("times")
for i in range(1,10):
times=[]
numbers=[]
origin=[]
time=0
number = choice(range(50,10000))
plt.plot(time,number,label=str(number))
while True:
plt.plot(times,origin,c="black")
plt.plot(times,numbers,lw=1.5)
time+=1
origin.append(0)
print(number)
if number%2==0: