The Collatz Conjecture on Roblox - The Simplest Math Problem No One Can Solve

In this simple yet interesting math problem, the answer seems to always fall to the 4, 2, 1 loop. It works like this. If the number is even, it is divided by two. If the number is odd then you multiply it by 3 and add 1. This problem can make interesting patterns and is really cool to see the numbers trickle down to 4, 2, 1.

So, for the number 5, it would go like this:

5
16 = 3(5) + 1
8 = 16 / 2
4 = 8 / 2
2 = 4 / 2
1 = 2 / 2

Yeah, we could do this in our heads, but for larger numbers that may take some time. That’s why we have computers to do the job!

x = Whatever number you want to start off with -- Ex: 10, 5, 1003

while x > 1 do
     if x%2 == 0 then -- If number is even or odd
         x = x / 2 -- Number is even so divide by two
     else
         x = x * 3 + 1 -- Number is odd so multiply by three and add one
     end
     print(x) -- Print the number in the output
end

If you just run this code you’ll get a series of numbers that end in 4, 2, 1. If you don’t end up in 4, 2, 1, let me know because you may have solved this math problem.

You can try it for yourself on this website while Roblox is down.

4 Likes

Very interesting! gonna check this out.

1 Like

I’ve seen that exact same video on YouTube a few days ago, glad to see it again. I tried math.huge and it takes quite a while to load in the output

EDIT: Checked the website again, just said www.tutorialspoint.com says and nothing else was shown

EDIT 2: 10^100 worked, and it (obviously) ended with 4, 2, & 1.

1 Like

I’ve made a graph of this a while ago so you can use https://replit.com and paste this code in to get a visual representation:

import matplotlib.pyplot as plt
   
startNum = 17

plt.title(f'Collatz Conjecture: {startNum}')

Terms = []
Value = []

index = 0
Terms.insert(index, index)
Value.insert(index, startNum)
while startNum > 1:
  index += 1
  if startNum % 2 == 1:
    startNum = startNum * 3 + 1
  else:
    startNum /= 2
  Terms.insert(index, index)
  Value.insert(index, startNum)

plt.plot(Terms, Value)
plt.xlabel('Terms')
plt.ylabel('Value')
plt.show()

image

1 Like

this reminds me of the four is magic problem
fun times

2 Likes

Mathematical chaos is gorgeous. Unimaginable designs coming from simple, iterated transformations. Almost akin to the birth of a universe: at some point in the visualization of the process, a fulcrum appears at which the data can no longer be contained by patterns, and it seems to become what he describes as “organic” – it breathes and stands on its own feet. It creates itself henceforth, almost as if it had a will, free of the pattern that gave it its wings. The engineer in me thinks pure math is hogwash and fairly useless to think about, but the artist in me can’t help but deeply admire and respect the language our world is written in.

1 Like