≡ Menu

# A (apparently) simple problem …

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:

$$3 \cdot 5 + 1 = 16\left( {{\text{even}}} \right);16/2 = 8;8/2 = 4;4/2 = 2;2/2 = 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…

{ 0 comments… add one }