recaman problem, pattern, dp