I have made a WPF application that constructs a Collatz Tree for the collatz conjecture problem. The collatz conjecture is that any number will eventually reach and terminate at 1 by following these steps:
If the number is even, divide the number by 2.
If the number is odd, multiply the number by 3 and add 1.
Repeat until number has reached 1.
Here is an example starting with 3:
3
10 (3x3+1)
5 (10/2)
16 (5x3+1)
8 (16/2)
4 (8/2)
2 (4/2)
1 (2/1)
The sequence starting with any number eventually reaches a 2^n number which is where it then begins to terminate.
My program (optionally) starts with 1 and shows the paths to reach 1.
Here is a screenshot:
The red numbers are numbers that satisfy the following: (n - 1) mod 3 = 2. All numbers under a red number will not branch out both directions; each of the red nodes can only have 1 child.





Reply With Quote