Here's a concrete example. I tried modifying the code so it generates a matrix of steps to get from each starting point to each goal, just like the matrix I posted earlier, and runs from 1 to 30 so I could directly compare the matrices they produce. They differ at some spots, one of which is the path going from 11 to 3. For some reason it took four steps and went 11/11=1, 11+11=22, 22/11=2, 2+1=3. Obviously a shorter path would be 11/11=1, 1+1=2, 1+2=3. Apparently there are two equally short paths from 11 to 2: {11/11=1, 1+1=2} and {11+11=22, 22/11=2}, and the algorithm ended up storing the second path as the most efficient path to get to 2. However, since it didn't store the path to 2 that creates 1 as an intermediate rather than 22, it wasn't able to discover that you could reach 3 from a path going to 2 through 1 that had a useful intermediate already generated.
There is a city of wise men.
Once, a clairvoyant came, summoned all the men in the square and said: "In this town there is at least one unfaithful wife. Whoever of you finds out that his wife is unfaithful, write her name on the blackboard at the church during the night, so that her shame serves as an example for others. "
Sages thoughtfully returned to their homes. Everyone knows about all other women, whether they are faithful or not... but noone knows about his own wife. They are proud of their wisdom, so they won't tell each other.
Exactly a week later, there were names of all the unfaithful women on the blackboard.
Write comma separated numbers of names at the blackboard after the first, second... up to seventh night.