But if it is a prime number, it will be visited twice (officer 1 and officer 'the prime number'), which means it will remain locked as the initial condition of all cells are locked.

This question is for testing whether you are a human visitor and to prevent automated spam submissions.