Share good ideas and conversation.   Login, Join Us, or Take a Tour!
comment by veen
veen  ·  47 days ago  ·  link  ·    ·  parent  ·  post: Collatz conjecture

Is there a graph version with the number on one axis and the number of steps until 1 on the other axis? Or would that look just unintelligible?




veen  ·  47 days ago  ·  link  ·  

That second graph is so cool! I decided to make my own real quick:

    import numpy, matplotlib.pyplot

matrix = numpy.zeros(10000)

for i in range(1, 10000):

counter = 0

pos = i

while pos != 1:

if pos % 2 == 0:

pos = pos / 2

counter = 1

else:

pos = pos*3 1

counter += 1

matrix[i] = counter

print(i, counter)

matplotlib.pyplot.figure(figsize = (20,10))

matplotlib.pyplot.scatter(range(1, 10000), matrix[1:10000], s=1)

(Gotta love Python eh!)