← Data packs

Collatz Conjecture in Minecraft

by Samster6868 · 2025-11-23 · Data packs

Collatz Conjecture in Minecraft preview

Compatible with Minecraft 1.21.10. You can use this datapack to count the steps from a given number down to 1 using the rules of the Collatz Conjecture. Below is a simplification of the rules. 1. Start with any positive integer. 2. If it is even, divide it by 2. 3. If it is odd, multiply it by 3 and add 1. After loading the datapack, use "/trigger collatz_input set <number>" to start the calculation. Each step is sent to the text chat, and then it generates a report. The report has five numbers: the starting value, the steps from the starting value to the maximum, the maximum, the steps from the maximum to one, and then the total amount of steps. There is also a simple report on the scoreboard sidebar. Enjoy!

FunctionsSimple