Longest path for knight Suppose the knight is on square X and he wants to get to square Y, and in order to do that he has to move N moves. how big could N be?

Could that be solved using a mathematical equation? Say Nf3 should capture Bg8, could that be solved mathematically without having to take a look and analyze it step by step? is there an equation?
The furthest distance is from one corner to the opposite one.  You can get from a1 to h8 in six moves, for example a1,c2,d4,f3,e5,g6,h8.  There are few pairs of squares that take more than four moves.