2
\$\begingroup\$

The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN.

As you can see, every button represents two numbers. Thus some PINs, like "1357" and "2367", are essentially identical because they require the same sequence of button presses.

Further, there is no "open" button so the lock always just takes the last 5 digits that were entered. For example, pressing "135791" would open the door for the PINs "1357", "3579", and "5791" (as well as all their equivalents).

Your task is to write a piece of code that outputs or returns a string of digits or list of numbers that, if entered, is guaranteed to open my garage door. Remember: when your result includes "1458", you don't need to output "2367" anymore. You can use all 10 digits, but using only odd or even digits is sufficient.

The shortest result sequence wins (measured in digits, 629 (4+5^4) is the theoretical minimum). If equal, the shortest code in bytes wins.

\$\endgroup\$
7
  • \$\begingroup\$ I'm voting to close this question as off-topic because I think this challenge would do better on Puzzling rather than here \$\endgroup\$
    – Blue
    Commented Jul 25, 2016 at 18:32
  • \$\begingroup\$ @muddyfish It's not actually difficult to find an optimal solution, so I don't think this is interesting from a puzzling perspective. \$\endgroup\$
    – Cephalopod
    Commented Jul 25, 2016 at 18:37
  • \$\begingroup\$ @FryAmTheEggman Since when is "shortest code in bytes wins" not a competition on this site? \$\endgroup\$
    – Cephalopod
    Commented Jul 25, 2016 at 18:43
  • 1
    \$\begingroup\$ Sorry, I missed the tie-breaker. However, that makes it seem like the initial winning criterion is rather pointless? \$\endgroup\$ Commented Jul 25, 2016 at 18:45
  • 1
    \$\begingroup\$ If it's not a duplicate of the one that Fry linked, it's possibly a duplicate of this one. \$\endgroup\$ Commented Jul 25, 2016 at 19:03

0