Created factorial function
Added the test