factorial with inject method