You begin this problem on an infinite by infinite chess board with a knight at the center of it. We'll call this square $(0, 0)$. Pick any square and find its coordinates, $(x, y)$.
In real chess knights can only go vertically 2 squares and then horizontally 1 square, or horizontally 2 squares and then vertically 1 square. However, this problem will be much more general. For this problem, the knight can go vertically $a$ square(s) and then horizontally $b$ square(s), or horizontally $a$ square(s) and then vertically $b$ square(s). $a$ and $b$ will both be constants.
The challenge here is to find a formula for how many moves the shortest path to that square ($x$, $y$) is, given an $a$ and a $b$.
Take note that for certain $a$'s and $b$'s and $x$'s and $y$'s no amount of moves could ever be enough to get it to that square. If $a$ and $b$ were both equal to $1$, it's pretty obvious that for any choice of $x$ and $y$ whose sums are an odd number, you would never be able to get to that square.
I put this under graph theory because you can think about this board as a graph. Place a node on each square. Put an edge from each square to the square the knight could move to if it were on that square.