a=int(raw_input("asdf"))
b=int((raw_input("Would you like results concatenated on one line? Otherwise, all progressive results will print out on multiple lines. Say 1 for yes and 2 for no.")))
c=[]
d=raw_input("What would you like the filename to be?")
while a != 1:
    while a%2 == 1:
        a=(a*3)+1
        c.append(a)
        if b==1:
            print str(a) + ", ",
        else:
            print str(a) + ", "
    else:
        a=int(a)/int(2)
        c.append(a)
        if b==1:
            print str(a) + ", ",
        else:
            print str(a) + ", "
print "                              3n+1 problem program - Michael McKenna"
f = open(d+'.txt', 'w')
f.write(str(c))
f.close()
c=raw_input("Finished! Please close.")

