Adding simple cache.
Changeching to algorithm solution as formula with factorials cannot
handle properly more than 35 levels.