MrList = [] n = 2 max = 0 def check(n): global max MrList.append(n) while(n > 1): if(n%2 == 0): n = n /2 MrList.append(n) else: n = (3 * n) + 1 MrList.append(n) if(len(MrList) > max): max = len(MrList) while(n < 1,000,000): MrList = [] check(n) n = n + 1 print MrList print max
I don't want the answer to the problem, but can someone just tell me what my logical errors are? I am super stuck
EDit: I wasn't correctly solving for the right problem lol..


Sign In
Create Account

Back to top









