Add class to compute factorials with memoization