Add f1() with memoization to p088