← All problemsSign in

Prime Lock

A prime lock is just like a normal multi-digit lock (as shown in the picture), except that instead of accepting a fixed code, it accepts any code that is a prime number (ignoring leading zeros)! For example, "002" and "103" are both valid unlock codes for a 3-digit prime lock. In a single step, you can choose one digit and rotate it to its next or previous digit. The digits are ordered from 0 to 9

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start