progs/collatz.scala
author Christian Urban <urbanc@in.tum.de>
Mon, 22 Aug 2016 09:14:22 +0200
changeset 413 b7221df9662a
parent 407 4b454a6d1814
permissions -rw-r--r--
removed

def collatz(n: BigInt) : Boolean = {
  if (n == 1) true else 
  if (n % 2 == 0) collatz(n / 2) else 
  collatz(3 * n + 1)
}