[Golfing] Collatz Conjecture 08-21-2015, 04:09 PM
#1
Since @Jolly mentioned this to me, I've been researching it and it's as interesting as it is fucking baffling.
The process is simple. You take any positive integer. If it's even, you divide it by two. If it's odd, times it by three and add one. Then you repeat the process with the answer.
Eventually, you'll end up with 1. No matter what the input was.
Your program must calculate and print the entire sequence from the input until you reach 1. Shortest program wins. (https://mothereff.in/byte-counter)
I'll post my solution later.
Leaderboard:
1) @Shebang - 45 Bytes
2) @Eclipse - 66 Bytes
3) @"Stocking" - 69 Bytes
4) @lux - 69 Bytes
5) @OversouL - 105 Bytes
The process is simple. You take any positive integer. If it's even, you divide it by two. If it's odd, times it by three and add one. Then you repeat the process with the answer.
Eventually, you'll end up with 1. No matter what the input was.
Your program must calculate and print the entire sequence from the input until you reach 1. Shortest program wins. (https://mothereff.in/byte-counter)
I'll post my solution later.
Leaderboard:
1) @Shebang - 45 Bytes
2) @Eclipse - 66 Bytes
3) @"Stocking" - 69 Bytes
4) @lux - 69 Bytes
5) @OversouL - 105 Bytes














![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)



![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)







If you have suggestions, I'd be glad to hear it.
![[Image: dHJ4Beo.gif]](http://i.imgur.com/dHJ4Beo.gif)
It's printing 10 5 1 for 20, when it should be printing 10 5 16 8 4 2 1. Once you fix that I'll show you a couple ways of shortening it