I\'m trying to solve this problem since weeks, but couldn\'t arrive to a solution.
You start with two numbers X and Y both equal to 1. Only valid options are X+Y
If the numbers are not that big (say, below 1000), you can use a breadth-first search.
Consider a directed graph where each vertex is a pair of numbers (X,Y), and from each such vertex there are two edges to vertices (X+Y,Y) and (X,X+Y). Run a BFS on that graph from (0,0) until you reach any of the positions you need.