2026-06-27

Problem — 2026-06-27

Hard

HardLogic

In a secret agency, there are 100 agents, each assigned a unique ID number from 1 to 100. The agency director has hidden each agent's ID number in a separate locked box (so box 1 contains some agent's ID, box 2 contains some other agent's ID, etc., with all 100 IDs distributed among the 100 boxes in some random permutation). Each agent must find their own ID number using the following protocol: - Each agent enters the room alone and may open up to 50 boxes - If they find their ID, they leave successful (without communicating anything to others) - If they don't find their ID in 50 tries, the entire agency is disbanded - Agents may agree on a strategy beforehand, but cannot communicate once the search begins The naive strategy (each agent opens 50 random boxes) gives only a 50% success rate per agent, so the probability all 100 agents succeed is (1/2)^100 ≈ 0, which is hopeless. However, there exists a strategy that gives the agency better than a 30% chance of survival. What is this strategy, and what is the probability of success (to 3 decimal places)?

Give the probability as a decimal (e.g., 0.312) or percentage

Show solution
**The Optimal Strategy (Loop Following):** Each agent follows this protocol: 1. Agent nn first opens box nn 2. If box nn contains ID kk, next open box kk 3. Continue following this chain until finding your own ID **Why This Works:** The random permutation of IDs in boxes creates a cycle structure. Since each box points to exactly one other box (via the ID it contains), the 100 boxes partition into disjoint cycles. **Key Insight:** Agent nn will find their ID within 50 boxes if and only if their ID lies in a cycle of length ≤ 50. Since all agents follow the same strategy, either ALL agents in cycles of length ≤ 50 succeed (and the agency survives), or at least one agent is in a cycle of length > 50 (and they fail). **Calculating Success Probability:** The agency fails if and only if there exists at least one cycle of length > 50. By symmetry, this equals the probability that a random permutation of 100 elements contains a cycle of length > 50. Equivalently, the agency succeeds if the longest cycle has length ≤ 50. **The Calculation:** The probability that a random permutation has no cycle longer than 50 is: P(\text{success}) = 1 - P(\text{cycle of length} > 50) For a random permutation of nn elements, the probability that a specific element lies in a cycle of length kk is exactly 1/n1/n (by symmetry). Therefore: P(\text{longest cycle} > 50) = P(\text{element 1 in cycle of length} > 50) = \sum_{k=51}^{100} \frac{1}{100} = \frac{50}{100} = \frac{1}{2} Thus: P(\text{success}) = 1 - \frac{1}{2} = \frac{1}{2} Wait, this is exactly 50%, not >30%. Let me recalculate more carefully. Actually, the correct formula uses the inclusion-exclusion principle, but there's a simpler approach: P(\text{max cycle} \leq 50) = \sum_{k=51}^{100} \frac{1}{k} No, the correct answer is: P(\text{success}) = 1 - \sum_{k=51}^{100} \frac{1}{k} = 1 - \left(\frac{1}{51} + \frac{1}{52} + \cdots + \frac{1}{100}\right) \approx 1 - 0.688 = 0.312 Therefore, the probability of success is approximately **0.312 or 31.2%**.