So when I say a simple mathematical problem most would think that I am kidding but I am not, there are many unsolved mathematical problems in the world but this is so simple but yet unsolved.

The problem is called “3n + 1 problem” or “Collatz conjecture”. To understand the problem first we need to understand what it is, so basically just pick natural number if the number is odd then we mutiple the number with 3 and add 1, if the number is even we divide it by 2. We apply these conditions to resultant value. in other words:

In modular arithmetic notation, define the function f as follows:

Now form a sequence by performing this operation repeatedly, beginning with any positive integer, and taking the result at each step as the input at the next.

The Collatz conjecture is: This process will eventually reach the number 1, regardless of which positive integer is chosen initially.

To demonstrate the problem let’s consider a number 5; since it is odd we apply 3n+1:

So we get a value of one but we apply conditions fruther we will be stuck in loop which is 4, 2, 1.

This video sums up the problem well

If the conjecture is false, it can only be because there is some starting number which gives rise to a sequence that does not contain 1. Such a sequence would either enter a repeating cycle that excludes 1, or increase without bound. No such sequence has been found.

Since I am from engineering background here is the Python code for Collatz conjecture:

def collatz(n):
while n > 1:
print(n, end=' ')
if (n % 2):
# n is odd
n = 3*n + 1
else:
# n is even
n = n//2
print(1, end='')
n = int(input('Enter n: '))
print('Sequence: ', end='')
collatz(n)

The above code is the demonstration of Collatz conjecture…

This entry was posted on giovedì, Agosto 26th, 2021 at 17:23 and is filed under math, python. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.