Re: security code
- From: anil.tendulakar@xxxxxxxxx
- Date: Sun, 21 Sep 2008 00:28:55 -0700 (PDT)
On Sep 20, 12:14 am, m...@xxxxxxx (Mark Brader) wrote:
Anil Tendulakar:
Say you have a number lock having number keys from 1 to 5. You are
allowed to press either single keys or a pair of number keys
simultaneously.
Also you cannot press 3 keys simultaneously or repeat a key which was
pressed previously. The order in which the keys were pressed matters
but when a pair is pressed simultaneously, there is no order between
them
If a total of 5 keys are pressed, there are 5! sequences using single
keypresses. Two consecutive keypresses could be replaced by a double
keypress at any of 4 places in the sequence, but then the order of the
two presses before they were replaced does not matter, so we drop a
factor of 2. This replacement could also be done in two places in the
sequence in any of 3 ways (the sequence of double and single presses
could be dds, dsd, sdd) and again we drop a factor of 2 with each
replacement. So that's 5! * (1 + 4/2 + 3/4) = 450.
If a total of 3 or 4 keys are pressed, each of these is equivalent to a
sequence with 5 keys, but with a final double or single keypress removed,
respectively. So that's another 450 combinations.
If 2 keys are pressed separately, there are 5*4 = 20 combinations,
and if together, 5*4/2 = 10. And if just 1 key is pressed, there are
5 combinations.
So the total number of possible combinations is 935.
--
Mark Brader, Toronto | "Courtesy, hell. We're programmers not humans."
m...@xxxxxxx | -- S. M. Ryan
My text in this article is in the public domain.
yup i got the same!
Single key (S, 2S, 3S, 4S, 5S): 5P1 + 5P2 + 5P3 + 5P4 + 5P5 = 325
Double key once (P, PS, P2S, P3S): 5C2 (3P0 + 3P1*2 + 3P2*3 + 3P3*4) =
490
Double key twice :( 2P, 2PS): 5C2*3C2*(3+1) = 120
TOTAL: 935
.
- References:
- security code
- From: anil . tendulakar
- Re: security code
- From: Mark Brader
- security code
- Prev by Date: Re: next term
- Next by Date: Bad pills
- Previous by thread: Re: security code
- Next by thread: The Joker’s plan
- Index(es):
Relevant Pages
|