Factorials

Implement a function factorial(n) that would return the factorial of the number n:
The input contains a single integer n.
The output should contain 4 numbers - n!, (2n)!, (n-1)!, (n+1)! each on a separate line.
Input
Output
5
120 3628800 24 720
Tip
Call the factorial() function 4 times; each time passing the new value that should be printed.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue