The collatz conjecture written in as many programming languages as possible - including non "real" languages.
Also known as the 3n+1 and n / 2 problem. Basically if a given number is odd, multiply it by 3 and add 1. If it is odd, divide it by two. Repeat these steps until it reaches 1.
This started as a challenge in an abanded Minecraft discord server to write the collatz conjecture in as many programming languages as possible. Now it's time to revive that challenge and make it public!
There's some rules to this challenge. The code or similar program must:
- Start from a number input by the user
- Time the calculation duration
- Log the number of steps and peak number reached.
Additional clarification - The program doesn't have to be 'real' code, meaning that non-programming things like powerpoint, flowgorithm, game commands, etc. still count. If you can make it do the collatz conjecture to those requirements, it will count.
Rule 1 and 2 can be ignored if input or duration measurement isn't possible or feasable. What this means is that if the platform you're trying on won't take that kind of input or function, you can skip it. It must be a hard restriction of the platform, however.
Bonus points for writing a more optimized version of code in any programming language. If you can prove that you have written the fastest code for evaluating the collatz conjecture (evaluate each starting number from 1-100,000), it can stay up next to the simple version. Also bonus points for writing the most compact code, or code golf.
Discussion is happening on the KiLAB Gaming discord, as this challenge was started there recently. Come join and talk Collatz! https://discord.gg/fkAW2zstyQ
Open a PR with your program/project that you wish to contribute. Make sure it follows the rules and is actually "worth" putting up. Make sure to add credit for yourself somewhere!