added some useful tools from Norvig's Udacity212 to use on future problems (memo, countcalls etc.)