Ranges memoization.