Function that takes a number and returns its factorial