Table of Contents
Introduction
I stumbled across an interesting paper, which shows that you can multiply two numbers by using the Collatz conjecture (and assuming it to be true for the numbers you are dealing with).
This post contains my summary and understanding of how this method works.
Background
Collatz conjecture
Definition
The Collatz conjecture, also known as the problem, is a simple to describe, yet unsolved, problem in discrete mathematics. The conjecture states that if you start with a positive integer and apply the following rule to it:
- If the number () is even, divide it by two:
- If the number () is odd, multiply it by 3 and add one:
The number will eventually land in the cycle . The conjecture states: this the only cycle. There is no proof to confirm this, however, we have tested up to a very large number and the conjecture seems to hold. Thus, for all practical purposes: the conjecture is true.
The rule can be mathematically written as:
Examples
- (cycle starts)
- (use above)
Method
Definitions
Collatz Function
Define the Collatz function, , as the Collatz conjecture with path of dividing by 2 compressed into one step, that is:
Given , a positive odd integer:
- gives the number of factors of 2 in a number, i.e. count the trailing zeros of a number in binary
Collatz sequence and
- The Collatz sequence, is the sequence of numbers produced by the Collatz function until it reaches the number for the first time
- Define as the number of steps until the Collatz series lands on
In other words, the Collatz sequence can be shown mathematically like so:
How to Divide:
Let's multiply the Collatz function series by , we get:
Let , we get
NOTES: when is odd
Assuming ( divides ), we can:
- Start with
- Use until we get to
- Record what we've done to get there
- i.e. save the result of along the way and (the number of steps)
- Backtrack using the same form of operations (in reverse) with whilst starting at
i.e. we have a division algorithm using the Collatz conjecture
How to Multiply:
Now, how do we multiply? Simple:
- Start with and use until we get to
- Record what we've done (save the steps)
- Now, start with and backtrack with (with the saved steps), which will get us to