progs/collatz.scala
changeset 407 4b454a6d1814
equal deleted inserted replaced
406:0a42d73e795b 407:4b454a6d1814
       
     1 def collatz(n: BigInt) : Boolean = {
       
     2   if (n == 1) true else 
       
     3   if (n % 2 == 0) collatz(n / 2) else 
       
     4   collatz(3 * n + 1)
       
     5 }