19
20
21 }
22
23
24 def Collat(n: Long, r: Int = 1) : Int =
25 if (n == 1) r else
26 if (n % 2 == 0) Collat(n / 2 , r + 1) else
27 Collat (3 * n + 1 , r + 1)
28
29 (1 to 10).map(collatz(_))