Pregunta de entrevista de Adobe

How would you code a factorial function using no built in functions in R?