Gaurangkumar-The Collatz conjecture

The Collatz conjecture[a] is one of the most famous unsolved problems in mathematics. The conjecture asks whether repeating two simple arithmetic operations will eventually transform every positive integer into 1.https://en.wikipedia.org/wiki/Collatz_conjecture?

?

The solution in simple words, all number made out of 1. Like 1=1?

2=1+1?

3=1+1+1?

4=1+1+1+1?

5=1+1+1+1+1?

Etc.?

?

I am saying not only 1 is repetitive but 4,2,1 is repetitive.?

?

3x+1 in if x=1 then, 3(1)+1= 4, then as per rules 4/2 =2 then 2/2=1 means 4,2,1?

?

Now if x=2 then 3(2)+1=7 then as per rules 3(7)+1=22, then 22/2= 11, then 3(11)+1= 34 then 34/2= 17, then 52/2=26,26/2=13,40/2=20,20/10=10,10/2=5, 3(5)+1=16, 16/2=8, 8/2=4, 4/2=2, 2/2=1?

?

?

Now if x=3 then 3(3)+1=10, 10/2 = 5, 3(5)+1=16, 16/2=8, 8/2=4, 4/2=2, 2/2=1?

?

If we see in all solutions starting from one of the small integers 4,2,1 is repetitive. Because in x=3 there is ans 5.?

all happing due to condition: -my(x+1) work same but then only2,1 is repetitive.? ?

We are multiplying by 3 but more than once we are dividing. ?

?

?

?

?

All is happening because of Conditions, noting else, if its undividable we add it back to the formula, If put even number in it, 2,4,6… then it’s converted by 3X+1 to 7,13….in odd number. Odd number as X gives us even numbers.?

?

https://en.wikipedia.org/wiki/Collatz_conjecture?


here actual coding :-

https://www.dhirubhai.net/pulse/collatz-conjecture-solution-g-p-lmgic/?trackingId=cuz2fxwpR0OASklG3Sko4w%3D%3D

class CollatzConjecture:

def init(self, x):

self.x = x

self.formula_sequence = []

self.T1_sequence = []

self.T2_sequence = [] # New list to store T2 values

self.count_sequence = [] # New list to store counts

self.final_T1 = None

self.x_sequence = [x] # List to store all values of x

def calculate_collatz(self):

formula = 3 * self.x + 1

self.formula_sequence.append(formula)

count = 0 # Initialize count to zero

while True:

if formula % 2 == 0:

T1 = formula / 2

else:

T1 = formula

self.T2_sequence.append(T1) # Store T1 as T2 when it's odd

self.count_sequence.append(count) # Store the count

self.final_T1 = T1 # Store the final T1 value

return count, T1 # Return the count and the final T1 value

self.T1_sequence.append(T1)

if T1 != 0.5 and T1 != 1:

count += 1 # Increment count if the condition is met

else:

self.count_sequence.append(count) # Store the count

self.final_T1 = T1 # Store the final T1 value

return count, T1 # Return the count and the final T1 value

formula = T1

self.x_sequence.append(self.x) # Append the current value of x to the sequence

def print_results(self):

final_sequence = list(set(self.T1_sequence + self.T2_sequence + self.formula_sequence))

print("X value:", self.x)

print("Final Sequence:", final_sequence)

gaurangkumar_list = [1, 2, 4]

match1 = all(item in final_sequence for item in gaurangkumar_list)

print("Match with Gaurangkumar's list:", match1)

check3_list = [3]

match2 = all(item in final_sequence for item in check3_list)

print("Match with Check3 list:", match2)

if name == "__main__":

n = int(input("Enter the value of n: "))

for x in range(1, n + 1):

collatz = CollatzConjecture(x)

while True:

count, final_T1 = collatz.calculate_collatz()

next_x = next((t2 for t2 in collatz.T2_sequence if t2 not in collatz.x_sequence), None)

if next_x is not None:

collatz.x = next_x

collatz.x_sequence.append(collatz.x)

else:

collatz.print_results()

if all(item in collatz.T1_sequence + collatz.T2_sequence + collatz.formula_sequence for item in [1, 2, 4]) and 3 not in collatz.T1_sequence + collatz.T2_sequence + collatz.formula_sequence:

break

break

here actual coding :-

https://www.dhirubhai.net/pulse/collatz-conjecture-solution-g-p-lmgic/?trackingId=cuz2fxwpR0OASklG3Sko4w%3D%3D



Theorem

For any positive integer n, if the following process is applied repeatedly:

  1. If n?is divisible by 2, divide n?by 2.
  2. If n?is not divisible by 2, replace n?with n + 1.

Then, the process will eventually reduce n?to 1.


Proof

Step 1: Define the process

At each step:

  • If n?is divisible by?2, divide by?2:? n → n /2.
  • If n?is not divisible by 2, add 1:? n → n + 1.

Step 2: Show the process terminates

The process generates a sequence of integers:? n0, n1, n2, …?where n0 = n?and each subsequent nk?is determined by applying the process above.

Key Insight: Each step reduces n?closer to 1?in the sense that:

  1. Adding 1?to an odd n?makes it even, allowing a division by 2.
  2. Repeated division by 2?will eventually reduce n?to 1, as the number of divisions required depends only on the powers of 2?in the factorization of n + k, where k?is the number of additions performed.

Step 3: Proof by contradiction

Assume the process does not terminate for some?n. Then, n?must repeat at some step, creating a cycle nk = nm for k > m.

However:

  1. If? nk?is divisible by? 2, dividing by? 2?reduces it strictly.
  2. If? nk?is not divisible by 2, adding 1?increases it slightly before the next division by 2.

Thus, n?strictly decreases or terminates at? 1, contradicting the assumption of a cycle. Therefore, the process must terminate.


Step 4: Example with powers of 2

If? n?is a power of? 2?(e.g.,?2k), the process divides? n?by? 2?repeatedly until? n = 1. For any non-power-of-2?n, the addition step guarantees it is converted into an even number that can continue dividing by? 2?to eventually reach? 1.


Conclusion

By induction and contradiction, for any positive integer? n, the process will always terminate at? 1.

wrote by ChatGPT....

Daniele Grosso

Research and Didactics (technical support / contract professor) - Department of Physics - University of Genova (IT)

1 个月

This is a somewhat new approach I would like to discuss: https://doi.org/10.5281/zenodo.14217848

回复

要查看或添加评论,请登录

Gaurangkumar Patel的更多文章

社区洞察

其他会员也浏览了