replace recursive factorial with iterative, remove intermediate variable for acceptance