Let A begin at 1. n! = A × 1 × 2 × 3 × ... × (n-1) × n ----- | Compute this product first and call result A = A × 2 × 3 × ... × (n-1) × n ----- | Compute this product next and call result A = A × 3 × ... × (n-1) × n . . (etc.) . = A × n = A = n!At each step, we transform the problem of computing
A × (low × low+1 × low+2 × ... high)into
(A × low) × (low+1 × low+2 × ... × high)So we have to know high as well as track a changing low.