Collatz calculator

By Pokipsy76 - English wikipedia, Public Domain,

Grundsätzlich IT B.V. would like to publish a small javascript tool: the Collatz Calculator, on the occasion of the publication of a new proof of the Collatz Conjecture.

Two days ago Peter Schorer published a new proof of the famous mathematical problem named the Collatz Conjecture. This doesn’t mean it has been proven, though: new proofs for this particular problem appear with depressing regularity, only to be invalidated in a few weeks. But we can always hope for the best!

The problem itself can be stated in simple terms:

Take any positive integer n.

  • If n is even, divide it by 2 to get n / 2
  • If n is odd, multiply it by 3 and add 1 to obtain 3n + 1

Repeat the process (which has been called “Half Or Triple Plus One”, or HOTPO[7]) indefinitely.

The conjecture is that no matter what number you start with, you will always eventually reach 1. This seems easy to prove, but the Collatz mapping above exhibits chaotic, even fractal behaviour. Thus, a proof has long been sought but not yet been found. Due to the relationship to several other longstanding mathematical problems, this problem has occupied mathematicians for at least a century, possibly much longer than that. Leading to frustration in some quarters.

Used with permission.

To get some idea of the complexities of the mapping, feel free to play with this Collatz Calculator (javascript): Start the Collatz Calculator


5 thoughts on “Collatz calculator

  1. david blizovski

    what about 4n+2 ? you cannot solve this version but the software show it reachs at last to 1 but it is false. Strange perhaps there is error in the software. i can explain more. you can start from 3 to test it.

    1. admin Post author

      Hi David, 4n+2 is not in the calculator.

      I assume you have the following algorithm:
      Take any positive integer n.
      If n is even, divide it by 2 to get n / 2
      If n is odd, multiply it by 4 and add 2 to obtain 4n + 2
      Repeat the process indefinitely until it reaches a fixed point.

      However, this will go infinite, since you always end up with an odd number at the division, as the 4n+2 always ends up with an even number and you basically get 2n+1 in the next step. 2n+1 is always an odd number as long as n is integer.

  2. Farzad hafezizadeh

    ok so nice problem i like it can you test this number? 2481012162432
    i write sample program but this is so hard to solve maybe you can?
    if you solve please tell me
    mr.Farzad hafezizadeh
    ma in OR
    bs softwear

    1. admin Post author

      Hi Farzad, I’m afraid I haven’t optimized the calculator for numbers as large as that. I’m not sure it’s impossible, but it could go up quite high.The algorithm i’m using in the calculator is quite simple and can’t handle that. Even if it can, it will take quite some time.

      If you need to do this you could program it, turning the number into an array of bits and then manipulating the bits. This would allow you to go to as big a number as you’d like.


Leave a Reply

Your email address will not be published. Required fields are marked *