Knight (Chess) Problem on telephone keyboard

222 Views Asked by At

There is phone keyboard with Knight on 0 (as shown below).

123
456
789
 0

Knight moves as per the rules of chess (2 straight and one turn).

T is no. of moves by knight and S is sum of key's values where knight moves.

After T = 1024 moves, What will be the probability that S is divisible by 5 given that it is already divisible by 7.

I tried by drawing a tree structure and found that sum S would occur in odd-even pattern in alternate values. I also found the range of values of S after T = 1024 moves. But I couldn't proceed further.