Bitcoin Forum
July 17, 2024, 05:43:09 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Solution to the Collatz conjecture (in case there is a prize in BTC)  (Read 12 times)
ElonMusk_ia (OP)
Newbie
*
Online Online

Activity: 8
Merit: 1


View Profile
Today at 02:41:06 PM
Merited by NotATether (1)
 #1




The Collatz conjecture, also known as the 3n+1 conjecture or Ulam's conjecture, was stated by mathematician Lothar Collatz in 1937.
Although it has puzzled the mathematical community for decades, it has yet to be solved. The conjecture states the following:

Starting with any positive integer:
If the number is even, divide by 2.
If the number is odd, multiply by 3 and add 1.
A sequence is formed by applying this operation repeatedly, taking the result of each step as input for the next.
The conjecture says that we will always reach the number 1, regardless of what number we start with.

Code:
import random



def collatz(n):
   
    while n != 1:
        print(n)

        if n % 2 == 0:
            n = n // 2
           
        else:
            n = 3*n + 1
    print(n)
    return n

collatz(random.randint(1,100000000))


A conjecture is a statement that is based on observations or evidence, but that has not yet been proven or disproven. In mathematics,
a conjecture is a problem that seeks a solution, and there is a prize of almost 1 million dollars for this.


The prize will be given to whoever offers a mathematical solution that certifies whether or not this is true for all numbers, and that said solution
is not refuted by the mathematical guild.




My solution to the problem:




To understand how it works we must modify the formula 3n+1


3n+1= 3n+i

where "i" must be an odd number.

and these two rules must be followed:

1- "i" must be an odd number.

The reason we apply this rule is to force 3n+i to give an even result, as we saw in the original conjecture.

2- n/i= Z

where Z refers to an integer: Z= {... -3,-2,-1, 0,+1,+2,+3 ...}


The reason we ignore this rule in the Collatz conjecture is because n/1=n


In both cases our final loop will be:

( i*4, i*2, i)

Now let's take a look at the new code corresponding to 3n+i and respecting the rule.




Code:
import random

i=7


def collatz(n):
   
    while n != i:
        print(n)

        if n % 2 == 0:
            n = n // 2
           
        else:
            n = 3*n + i
    print(n)
    return n

collatz(i*random.randint(1,100000000))
                 
print("final loop= "+str(i*4)+","+str( i*2)+","+str( i))


Why does it always reduce to "i"?

Forcing 3n+i to give an even result, as we can see in the original conjecture, statistically increases the number of times we divide by 2, leaving an approximate of 40-60% more divisions compared to multiplication by 3.

as you can see in the following code.


Code:
import random

i= 7

def collatz(n):
    even_count = 0
    odd_count = 0

    while n != i:
        if n % 2 == 0:
            even_count += 1
            n = n // 2
        else:
            odd_count += 1
            n = 3 * n + i

    return n, even_count, odd_count

random_number = i*random.randint(1, 100000000)
result, even, odd = collatz(random_number)

print(f"The Collatz sequence for {random_number} ends at {result}.")
print(f"Even numbers encountered: {even}")
print(f"Odd numbers encountered: {odd}")


So we can conclude that the Collatz conjecture is true for all numbers.




Thanks for reading, if there is a reward in BTC (I'm not sure there is) I'll leave my wallet to whoever might be interested in my profile, I also uploaded a paper on the official page for mathematicians.
NotATether
Legendary
*
Offline Offline

Activity: 1666
Merit: 7045


In memory of o_e_l_e_o


View Profile WWW
Today at 05:01:21 PM
 #2

I can't give you prize money, but I can give you a merit.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!