This is lab 3. I did a simple python equation that takes the number that you input and it multiples it by 3 and adds one to it then divides it by 2 and goes all over again to multiply that number by 3 and adds one to it and divides that result by 2 and so on.
screenshot:
sources:
a= raw_input(‘please enter number’)
n= int(a)
while n != 1:
print n,
if n%2 == 0:
n = n/2
else:
n = n*3+1
print n