Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8782269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:31:41+00:00 2026-06-13T20:31:41+00:00

Possible Duplicate: Need help in building efficient exhaustive search algorithm Imagine that you must

  • 0

Possible Duplicate:
Need help in building efficient exhaustive search algorithm

Imagine that you must open a locked door by inputting the correct 4-digit code on a keypad. After every keypress the lock evaluates the sequence of the last 4 digits inputted, i.e. by entering 123456 you have evaluated 3 codes: 1234, 2345 and 3456.

  • What is the shortest sequence of keypresses to evaluate all 10^4 different combinations?
  • Is there a method for traversing the entire space easy enough for a human to follow?

I have pondered this from time to time since a friend of mine had to brute force such a lock, to not having to spend the night outdoors in wintertime.


My feeble attempts at wrapping my head around it

With a code of length L=4 digits and an “alphabet” of digits of size D=10 the length of the optimal sequence cannot be shorter than D^L + L - 1. In simulations of smaller size than [L,D] = [4,10] I have obtained optimal results by semi-randomly searching the space. However I do not know if a solution exists for an arbitrary [L,D] pair and would not be able to remember the solution if I ever had to use it.

Lessons learned so far

When planning to spend the night at a friends house in another town, be sure to not arrive at 1 am if that person is going out to party and won’t hear her cell phone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:31:42+00:00Added an answer on June 13, 2026 at 8:31 pm

    The link Evgeny provided should answer both of your quests. This answer is a bit offtopic, but you ask for a solution for humans.

    In the real world you should probably rely more on Social engineering or heuristics, and after that on mathematics. I give a case on real life:

    I went to visit an apartment and I found out that my cellphone was dead. Now way of contacting the person doing the visit. I was about to go back when I saw that the door used a keypad 0 - 9 and A B. I made several assumptions:

    1. The code is 5 digits long. The length is pretty standard depending on the region you are in. I based this assumption on buildings I had access before (legally :D).
    2. The code starts with numbers, then either A or B (based on my own building).
    3. The keypad was not brand new. Conclusion, the numbers used in the code were a bit damaged. I knew with certainty which numbers were not in the code, and three of the four number in the code (given my previous assumptions)
    4. By the amount of keys damaged I assumed the code didn’t contain repeated keys (7 were damaged, it was clear A was used, B not used )

    At the end I had 3 numbers which were in the code for sure, 2 candidates for the last number and I was sure A was at the end. On key was just slightly damaged compared to the others.

    I just had to enumerate permutations starting with the candidate which seemed the more damaged, which give me 4! + 4! = 48 tries. Believe me, at the 5th try the door was opened. If I can give my 2 cents, the old put a key and open the door is still the most reliable method to restrict access to a building.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: need help with some stored procedure plz ERROR:- A SELECT statement that
Possible Duplicate: Need help with a SQL query that combines adjacent rows into a
Possible Duplicate: Image comparison algorithm So basically i need to write a program that
Possible Duplicate: Regular expression: match all words except I need your help for using
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Possible Duplicate: Assign click handlers in for loop I need help with a loop
Possible Duplicate: Need help solving Project Euler problem 200 Similar to this question Project
Possible Duplicate: Detecting closest or parent div I need some help about finding elements
Possible Duplicate: Function triggering early calling a functions value I need some help. I
Possible Duplicate: Need help with getline() I'm trying to use the getline function in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.