Collatz conjecture - Scala implementation