Why does it only spam 4, 2, 1
I thought it would be fun to make a bot for the 3x+1 theorum but for some reason, no matter what number, it always spams out 4, 2, 1, the end of the sequence. Why is this?
Did you see veritasium's video? It explains it so well. See if i get 4,
4 = even
4/2 = 2
2 = even
2/2 = 1
1 = odd
3×1+1 = 4
See? It loops.
@QuantumCodes Yes I learned about it from the Veritasium video. But I coded it so that it would go like this:
Let's say I have the number... um... 12
It's even so you divide it by 2.
6 is even so you divide it by 2
3 is odd so you multiply by 3 and add 1
10 is even so you get 5
and the bot would print all those numbers until it leads to 4, 2, 1