Tag Archives: maths

Solving 5 mathematical Conjecture puzzles with Python code

There are many complex math puzzles that have stumped mathematicians and puzzle enthusiasts alike. Here are 5 mathematical conjecture puzzles that I have attempted to explain and solve using Python:

The Collatz Conjecture

The Collatz conjecture is a mathematical problem that involves a sequence of positive integers that are generated according to a specific rule. The conjecture states that for any positive integer, the sequence will eventually reach the number 1, regardless of the starting number.

Here is a simple Python function that generates the Collatz sequence for a given starting number:

def collatz(n):
    while n != 1:
        print(n, end=", ")
        if n % 2 == 0:
            n = n // 2
        else:
            n = 3*n + 1
    print(1)

To use this function, you would simply call it with a positive integer as the argument, like this:

collatz(10)

This would output the following sequence:

10, 5, 16, 8, 4, 2, 1

The conjecture has been verified for many starting numbers, but it has not been proven for all positive integers. Despite much effort, a general proof or counterexample has not yet been found.

Continue reading Solving 5 mathematical Conjecture puzzles with Python code