this version will only print the largest step, which for me, is about 80 million, with 1,347 trillion branches
from numpy.random import binomial
import os
def intWithCommas(x):
if type(x) not in [type(0), type(0L)]:
raise TypeError("Parameter must be an integer.")
if x < 0:
return '-' + intWithCommas(-x)
result = ''
while x >= 1000:
x, r = divmod(x, 1000)
result = ",%03d%s" % (r, result)
return "%d%s" % (x, result)
def step(flip):
result = binomial((2*flip),0.5)
return result
trial = 0
filter = 0
while 1:
derp = 1
steps = 0
size = 0
while derp > 0:
perp = step(derp)
derp = perp
steps = steps + 1
size = size + perp
trial = trial + 1
if steps > filter:
filter = steps
os.system('cls')
print intWithCommas(trial), intWithCommas(steps), intWithCommas(size)