Scala Implementation of Factorial of a number