A knight stands on an infinitely large chess board, on a square with coordinates ( 0 , 0 ) . Through a sequence of valid knight's moves, it can reach square ( 2 2 , 1 8 ) .
Question 1: What is the minimum number of moves needed to accomplish this?
Question 2: How many different sequences of moves of minimum length accomplish this?
Report your answers by concatenating them. For instance, if there answer to question 1 is 83 and the answer to question 2 is 155, post the solution "83155".
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Yes, that is exactly it!
One detail, though: One cannot assume beforehand that only moves are needed that increase x + y .
If we were to arrive at ( 2 3 , 1 8 ) , you would find these paths of length 15:
1 2 3 |
|
but miss out on
1 2 |
|
which also are paths of length 15...
Log in to reply
Since solutions exist which always increase x + y , the question is academic. Looked at another way, any solution which decreases x + y at any stage must take at least 1 5 moves (at least one negative move and at least 1 4 positive moves of 1 or 3 to recoup the more than 4 0 points of x + y needed to get from ( 0 , 0 ) to ( 2 2 , 1 8 ) . Again, since solutions of length 1 4 exist, negative moves can be ignored...
Log in to reply
That is correct; I just missed this reasoning step in your solution. It is instructive to see where the case ( 2 3 , 1 8 ) goes different. Instead of 4 0 and 4 we now have 4 1 and 5 ; now b + d ≡ 2 mod 3. This leads to the solutions with ( b , d ) = ( 0 , 2 ) ; ( 1 , 1 ) ; ( 2 , 0 ) .
However , we can also consider this a case where b + d ≡ − 1 mod 3, and use ( b , d ) = ( − 1 , 0 ) ; ( 0 , − 1 ) . They turn out to have the same total length as the "positive" solutions.
In the original problem this would correspond to solving b + d = − 2 . It is true that these would lead to longer paths, but it is not trivial!
Btw, your posted solution in the second display equation has = 0 where is should be = 1 8 .
Log in to reply
@Arjen Vreugdenhil – Yes, your problem, as stated, is right on the edge. Change it slightly and it becomes hugely more complex! Thatnks for spotting the typo.
Problem Loading...
Note Loading...
Set Loading...
Knight's moves involve translations through ± ( 1 2 ) , ± ( − 1 2 ) , ± ( 2 1 ) and ± ( 2 − 1 ) . If we are going to move from ( 0 , 0 ) to ( 2 2 , 1 8 ) in the least number of moves, we will only be interested in moves that increase the sum x + y of the coordinates ( x , y ) of the squares visited. This cuts the number of possible moves in half. Note that this simplification is possible because there exist solutions which only use "positive" moves.
Suppose that we move from ( 0 , 0 ) to ( 2 2 , 1 8 ) after a total of a translations by ( 1 2 ) , b translations by ( − 1 2 ) , c translations by ( 2 1 ) and d translations by ( 2 − 1 ) . Then 2 a + 2 b + c − d = 2 2 a − b + 2 c + 2 d = 1 8 , and hence ( a − c ) + 3 ( b − d ) = 4 3 ( a + c ) + ( b + d ) = 4 0 . We want a , b , c , d to be nonnegative integers, and for a + b + c + d to be as small as possible. Since 4 0 = ( a + b + c + d ) + 2 ( a + c ) , we want a + c to be as large as possible, and hence b + d must be as small as possible. Since b + d ≡ 1 ( m o d 3 ) , the best we can hope for is b + d = 1 . There are two solutions with b + d = 1 , namely a = 7 , b = 1 , c = 6 , d = 0 a = 1 0 , b = 0 , c = 3 , d = 1 . Either of these solutions involve a total number of 1 4 translations. Thus the minimum number of moves from ( 0 , 0 ) to ( 2 2 , 1 8 ) is 1 4 .
There are 7 ! 6 ! 1 ! 1 4 ! = 2 4 0 2 4 ways of achieving the first type of move, and 1 0 ! 3 ! 1 ! 1 4 ! = 4 0 0 4 ways of achieving the second type of move. Thus there are a total of 2 8 0 2 8 ways of getting from ( 0 , 0 ) to ( 2 2 , 1 8 ) in 1 4 moves.
The answer is the concatenation of 1 4 and 2 8 0 2 8 , namely 1 4 2 8 0 2 8 .