Return to Snippet

Revision: 65924
at February 10, 2014 18:37 by bretsky


Initial Code
def mathprob_no_print(x):
    string2 = str(x)
    while x != 1:
        if x % 2 == 0: 
            x = x/2
        else:
            x = 3 * x + 1
    if x == 1:
        return string2+" was a failure"
    else: 
        return string2+" passed the test!"

 

def math_repeat(x,p):
    while x <= p:
        print mathprob_no_print(x)
        x = x + 1 
        
math_repeat(1,100)

Initial URL


Initial Description
Try it out in a python interpreter!

Initial Title
Collatz conjecture tester (only prints results)

Initial Tags


Initial Language
Python