2
$\begingroup$

Suppose a standard combination lock on a door has 5 distinct buttons (labelled e.g. 1, 2, 3, 4, 5).

A passcode is defined by 5 button presses.
Buttons can be repeated, so e.g. (5,5,5,5,5), (4,4,4,5,4), (1,2,4,3,5) are all valid passcodes.

The deluxe version of the lock allows "joins". A join is when two distinct buttons are pressed at the same time, so for example the four following codes are all valid and distinct:

  • (1, 2, 3, 4+5),
  • (1, 2+3, 4+5),
  • (1, 2+3, 4, 5), and
  • (1, 2, 3, 4, 5).

How many passcodes are possible in the standard and deluxe locks?

My attempt:

Standard lock: You can choose any character 5 times, so there are $5^5 = 3125$ standard passcodes.

Deluxe lock: Deluxe lock codes have either 0, 1, or 2 joins.

The 0-join codes are the 3125 for the standard lock.

The 1-join codes can have a join in one of four positions (between characters 1&2, 2&3, 3&4, 4&5). Having one join only constrains one of the characters (it has to be different to the character preceeding it). So for each of the four 1-join-positions, there are $5^4 \times 4$ choices of codes, so there are $5^4 \times 4^2 = 10000$ 1-join codes.

The 2-join codes must either be between characters 1&2 and 3&4, or 1&2 and 4&5, or 2&3 and 3&4. Having 2 joins constrains each of two of the characters to be different to the character preceeding it. So for each of the three 2-join-positions, there are $5^3 \times 4^2$ choices of codes, so there are $5^3 \times 4^2 \times 3= 6000$ 2-join codes.

So, all in all there are $3125 + 10000 + 6000 = 19125$ codes in the deluxe lock.

$\endgroup$
  • 1
    $\begingroup$ Your answer is correct $\endgroup$ – sashas Dec 24 '14 at 9:02
1
$\begingroup$

If $1-2$ is the same as $2-1$, there are only $5^3*10*4=5000$ 1-join codes.

$\endgroup$
  • $\begingroup$ Thanks. Is the total therefore 3125 + 5000 + 6000/4 = 9625? $\endgroup$ – oks Feb 13 '15 at 10:02
  • $\begingroup$ I think so, yes. $\endgroup$ – Empy2 Feb 13 '15 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.