N can be infinite. I can always make a zillion knight moves. So I expect you really want to know the smallest number of moves a Knight needs to get from square A to square B.
Some N's won't work. A Knight on a1 can't get to b3 in any even number of moves.
One thing we know - if the start and end squares are the same color, it will take an even number of moves. If they are different colors, it will take an odd number of moves.
It doesn't take long to figure out the longest path on the board (a8 to h1 for example) requires six moves. Note the start and end squares are the same color. For alternating colors, the requirement is 5 moves, max.
I don't think there will be an equation where one enters the square locations and a single number comes out.