Collatz Counts Square

Taking the steps from random numbers between a range of ( 4 , random ( 5 , 20 ) ) and pulling them into 4 and plucking those into a line it creates a cool square I tried with larger values and it always comes up as drawing a square.

What is Collatz ? Take a number now if that number is even / 2 if odd * 3 + 1 keep repeating this until the number == 1 what I did is basically count for each number how much that loop runs and it creates this cool looking pattern.

3 Likes

Do you mean that you are dividing a single random number into four groups of digits and then assigning those to x1,y1,x2,y2 ?

1 Like

I am creating four digits , where each is within the random constrain , after those are generated. Those are plugged in into Collatz and I count for each how many iterations it took in the loop to go down to == 1 and to be safe I use MAP so they all can fit on the screen. I have made something similar but with rect() I only provided pos.x and pos.y for each and it created also square like patterns. I also tested small values with this without MAP ( because one could say that because values are larger they are getting mapped ( squeezed )to smaller coordinates for the screen size and therefore producing similar spots ( Like for example when producing hashes for hash tables ) ), it produced the same pattern.

Interesting. Iā€™d love to see the sketch code if you are willing to share!