Collatz Conjecture

Published 2020-10-15


The iteration (or sequence):

n is a positive integer
0.5n if n is even
3n + 1 if n is odd

Wow plots! These were generated by preforming the sequence on a large set of numbers and recording the number of iterations it took to reach 1.

Collatz

Histogram

What's cool is that this sequence is easy to parallelize. Boom, lets use a GPU. The code was written using the native Rust implementation of WebGPU: wgpu.

AMD Nvidia

Read more on Wikipedia.