>> I get for this for (222, 9999) -- >> [222, 224, 112, 56, 28, 14, 16, 18, 36, 38, 76, 78, 156, 312, 624, >> 1248, >> 2496, 2498, 4996, 4998, 9996, 19992, 19994, 9997, 9999] > > My code dies a horrible death on this one. <laughs> I think I get a > right answer, but the wait was embarrassing: > > $ time ruby numeric_maze.rb 222 9999 > 222, 224, 112, 56, 58, 29, 31, 33, 35, 37, 39, 78, 156, 312, 624, > 1248, 2496, 2498, 4996, 4998, 9996, 19992, 19994, 9997, 9999 > > real 96m13.978s > user 49m27.502s > sys 46m22.817s > > Guess I need more than my one optimization now. <laughs> I stopped at 222 -> 4998 which took 43 seconds. Each next step will take a rough factor 3, so I'll end up near 3 hours. Oops... First pruning... Slices running time to less than 0.2 seconds *wheee* and to 9999 in slightly more than 0.2 seconds (which proves I got rid of that nasty exponential thing).