progs/collatz.scala
author Christian Urban <urbanc@in.tum.de>
Sun, 27 Oct 2019 13:55:43 +0000
changeset 676 62d168bf7ac8
parent 407 4b454a6d1814
permissions -rw-r--r--
ypdated

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