# Spin dem clocks

**Computer Science**Level 5

There are nine clocks on a \(3 \times 3\) array labeled **A** to **I**.The goal is to return all the dials to **12 o'clock** with as few moves as possible.

There are nine different allowed ways to turn the dials on the clocks. Each such way is called a move. Select for each move a number 1 to 9. That number will turn the dials 90' (degrees) clockwise on those clocks which are affected according to the table below.

Move | Affected clocks |

1 | ABDE |

2 | ABC |

3 | BCEF |

4 | ADG |

5 | BDEFH |

6 | CFI |

7 | DEGH |

8 | GHI |

9 | EFHI |

For the configuration in the picture above, let \(L\) be the shortest possible sequence of moves that will lead to all the clocks being \(12\) o'clock. Off all possible values of \(L\),what is the smallest **prime** value of \(L\)?

**Explanatory examples**

We do not care about the clocks minute hand in this problem. A clock at

**6**after one move(rotated clock wise) becomes**9**and a clock at**12**after one move becomes**3**and so on.If the sequence of moves had been \(L=\) \(1\) and \(3\), the answer would have been \(13\) instead of \(31\) because it is the smallest prime value of \(L\).

**Your answer seems reasonable.**Find out if you're right!

**That seems reasonable.**Find out if you're right!

Already have an account? Log in here.