the 3x+1 algorithm is an algorithm that multiplies odd numbers by 3 then adds one. it divides even numbers by 2. it stops at one because it will enter an infinite loop of 4 -> 2 -> 1 over and over. this can quickly compute these numbers.
At the beginning there will be some lag on low-end devices as it calculates odd and even numbers up to 1 million.