Problem 648. Cumulative probability of finding an unlikely combination

This is a supplemental problem to the CryptoMath problem. If you solve the problem methodically or randomly matters for expected solution time. This calculates the difference in techniques. My reference solution has some commented out graphics code to visualize the timing differences.


If you have N possible combinations to a lock you can calculate the likelihood of opening the lock as a percentage given X attempts.

There are two ways to figure out the combination to try:

  • Try a random one, possibly trying an old one again
  • Methodically doing them in order

Choosing a random combination is very fast and easy. No record keeping needed. Choosing a methodical way of trying them all is a little slower on each attempt, and incurs a fix cost before the first attempt is made.

If you have:

  • Goal of G% cumulative probability of opening the lock
  • Fixed cost of F seconds to start the methodical style
  • TR seconds per random attempt
  • TM seconds per methodical attempt
  • N equally likely combinations

Which technique should you use to get to your goal chance fastest?

  • 0 for random
  • 1 for methodical

--- Note for the curious: The really short solution is gaming the system and just choosing randomly. Eventually one of the solutions will guess right on all the test suite.

Solution Stats

21.21% Correct | 78.79% Incorrect
Last solution submitted on Aug 27, 2017

Problem Comments

Solution Comments


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!