Added recursion call results caching for problem 31