-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14.py
56 lines (41 loc) · 856 Bytes
/
14.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def odd_fun(n):
return 3 * n + 1
def even_fun(n):
return n/2
def return_one(n):
i = 1
while n != 1:
i += 1
if n % 2 == 0:
n = even_fun(n)
else:
n = odd_fun(n)
return i
if __name__ == '__main__':
i = 0
list = [0]
#i = 1000000
while 1:
i += 1
if max(list) < return_one(i):
max_num = i
list.append(return_one(i))
if i == 1000000:
#if i == 100:
break
print max(list)
print max_num
#print list.index(max(list))
#while i != 1:
#i -= 1
##print return_one(i)
#list.append(return_one(i))
#print list
#print max(list)
#print max(list)
#print ""
#i = 0
#for i in list:
#print i