UPSC Prelims 2022·CSAT·Quantitative Aptitude·Combinatorics and Probability

There is a numeric lock which has a 3-digit PIN. The PIN contains digits 1 to 7. There is no repetition of digits. The digits in the PIN from left to right are in decreasing order. Any two digits in the PIN differ by at least 2. How many maximum attempts does one need to find out the PIN with certainty?

Dalvoy logo
Reviewed by Dalvoy
UPSC Civil Services preparation
Last updated 23 May 2026, 3:31 pm IST
  1. A6
  2. B8
  3. C10Correct
  4. D12

Explanation

The problem asks for the maximum number of attempts needed to find a 3-digit PIN with certainty. This is equivalent to finding the total number of possible valid PINs that satisfy all given conditions. Let the 3-digit PIN be represented as XYZ. The conditions are: 1. The digits are from 1 to 7 (i.e., {1, 2, 3, 4, 5, 6, 7}). 2. No repetition of digits (X, Y, Z are distinct). 3. The digits are in decreasing order from left to right (X > Y > Z). 4. Any two digits in the PIN differ by at least 2. This implies X - Y >= 2 and Y - Z >= 2. (The condition X - Z >= 2 is automatically satisfied if X > Y > Z, X - Y >= 2, and Y - Z >= 2). Let's list all possible valid PINs by systematically choosing the digits: 1. Starting with X = 7 (the largest possible digit): * If Y = 5 (since 7 - 5 = 2, satisfying X - Y >= 2): Z must be chosen such that 5 - Z >= 2, so Z = 1. Possible Z values: {3, 2, 1}. This gives PINs: (7, 5, 3), (7, 5, 2), (7, 5, 1) - (3 PINs) * If Y = 4 (since 7 - 4 = 3, satisfying X - Y >= 2): Z must be chosen such that 4 - Z >= 2, so Z = 1. Possible Z values: {2, 1}. This gives PINs: (7, 4, 2), (7, 4, 1) - (2 PINs) * If Y = 3 (since 7 - 3 = 4, satisfying X - Y >= 2): Z must be chosen such that 3 - Z >= 2, so Z = 1. Possible Z value: {1}. This gives PIN: (7, 3, 1) - (1 PIN) * (Note: Y cannot be 6 because 7 - 6 = 1, which is not >= 2. Y cannot be less than 3 because Y - Z >= 2 and Z must be at least 1, so Y must be at least 3.) Total PINs for X = 7: 3 + 2 + 1 = 6 PINs. 2. Starting with X = 6: * If Y = 4 (since 6 - 4 = 2, satisfying X - Y >= 2): Z must be chosen such that 4 - Z >= 2, so Z = 1. Possible Z values: {2, 1}. This gives PINs: (6, 4, 2), (6, 4, 1) - (2 PINs) * If Y = 3 (since 6 - 3 = 3, satisfying X - Y >= 2): Z must be chosen such that 3 - Z >= 2, so Z = 1. Possible Z value: {1}. This gives PIN: (6, 3, 1) - (1 PIN) * (Note: Y cannot be 5 because 6 - 5 = 1. Y cannot be less than 3.) Total PINs for X = 6: 2 + 1 = 3 PINs. 3. Starting with X = 5: * If Y = 3 (since 5 - 3 = 2, satisfying X - Y >= 2): Z must be chosen such that 3 - Z >= 2, so Z = 1. Possible Z value: {1}. This gives PIN: (5, 3, 1) - (1 PIN) * (Note: Y cannot be 4 because 5 - 4 = 1. Y cannot be less than 3.) Total PINs for X = 5: 1 PIN. 4. Starting with X = 4: * If X = 4, then Y must be = 2). However, Y must also be >= 3 (because Y - Z >= 2 and Z >= 1, so Y >= 1 + 2 = 3). These conditions (Y = 3) are contradictory. Therefore, no PINs can start with 4 or any smaller digit. Total number of possible valid PINs = 6 (for X=7) + 3 (for X=6) + 1 (for X=5) = 10 PINs. To find the PIN with certainty, one might have to try all possible valid PINs in the worst-case scenario. If there are 10 possible PINs, the maximum number of attempts needed is 10. The final answer is C.
Quantitative Aptitude: There is a numeric lock which has a 3-digit PIN. The PIN contains digits 1 to 7. There is no repetition of digits. The d

Related questions

More UPSC Prelims practice from the same subject and topic.