faster memorization in euler 74

cache all elems in a chain