initialize factorial
first iterative solution