import scala.annotation.tailrec @tailrec def f(n: BigInt, a: BigInt = 1): BigInt = if (n <= 1) a else f(n-1, n*a)