Collatz conjecture: the histogram of stopping times
I derived the frequency distribution of stopping times in the previous article.
The histgram of stopping times from 1 to 10^8 is shown in the following cite.
https://en.wikipedia.org/wiki/Collatz_conjecture#/media/File:CollatzStatistic100million.png
The formula of frequency distribution is
eq(1)
The rsult is
Here,
The python code is
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 21:29:36 2017
@author: HobbyMath
"""
import numpy as np
import matplotlib.pylab as plt
v = np.log(4 / 3.0) / (np.log(3))
scale = 2.0 / np.log(3.0)
A=4.5-(3+v)/scale
B = np.sqrt(2/A)
all_num = 10**8
X = scale * np.log(all_num)
T_s = np.arange(50, 550)
#T_s independent
eta = 6 - 2 / scale - 2 * A * B
lam = v + 2 * A / (3 + v) + 2 / scale - 3
#T_S dependent
wT = 2 /(3+v) + X / ( (3 + v) * T_s)
y = T_s * (-A * (B - wT) **2 / wT + eta)
hist = B * X * np.sqrt(wT) / (scale * (B**2 - wT**2) * np.sqrt(np.pi * A)) * np.exp(y) / T_s**1.5
#Plot histogram of stopping times
plt.plot(T_s, hist )
plt.xlabel("stopping times")