Revision: 65923
Updated Code
at February 10, 2014 18:29 by bretsky
Updated Code
def mathprob_no_print(x):
while x != 1:
if x % 2 == 0:
x = x/2
else:
x = 3 * x + 1
if x == 1:
return x
def mathprob(x):
string = str(x)
print string+"!!!!!!!!!!!!!!!!! This is the starting number!"
while x != 1:
if x % 2 == 0:
x = x/2
print x
else:
x = 3 * x + 1
print x
if x == 1:
return x
def math_repeat(x,p):
while x <= p:
mathprob (x)
x = x + 1
if mathprob_no_print(x) != 1:
print "****YAY****YAY****WE PROVED HIS CONJECTURE WRONG!!!!!!!!!!"
math_repeat(1,100)
Revision: 65922
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 10, 2014 14:34 by bretsky
Initial Code
def mathprob(x):
string = str(x)
print string+"!!!!!!!!!!!!!!!!! This is the start number!"
while x != 1:
if x % 2 == 0: #n is even
x = x/2
print x
else:
x = 3 * x + 1
print x
if x == 1:
return x
def math_repeat(n,p):
mathprob (n)
while n <= p:
n = n + 1
mathprob(n)
math_repeat(1,100)
Initial URL
Initial Description
Cool little code that will test the Collatz conjecture
Initial Title
Collatz conjecture tester
Initial Tags
Initial Language
Python