reduce is the factorial