Created
February 22, 2019 08:56
-
-
Save macbre/5e42042f9836194453f10bc8fd3189b3 to your computer and use it in GitHub Desktop.
Loko-ciąg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
def get_iters_count(n): | |
i = 0 | |
while True: | |
i += 1 | |
# print(i, n) | |
if n == 1: | |
break | |
if n % 2 == 0: | |
n = n/2 | |
else: | |
n = 3*n + 1 | |
return i | |
for n in xrange(1, 1024): | |
iters = get_iters_count(n) | |
if iters > 100: | |
print("%5d %5d %s" % (n, iters, '=' * (iters / 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment