0
$\begingroup$

A passcode is either 4, 5, 6 digits and has primes from {$2, 3, 5, 7$}. How many passcodes are there such that they are from the primes above and have at least one 2?

Confusion: When I have something like how many possible codes that are 4 digits long and are from {0->10}

Is something like $2222$ counted 4 times?

  • 0
    To avoid double counting you might create a tree of dependent choices which begins with the position of the leftmost `2`. For each position to the left, the options are limited to `3,5,7`, but four options are available for each position to the right of this "first" `2`.2017-01-26

1 Answers 1

0

If you ignore the constraint then there are $$4^4+4^5+4^6=5376$$

The number of passwords which don't use $2$ is $$3^4+3^5+3^6=1053$$

You want the complement, hence $$5376-1053=\boxed {4323}$$

To your side question: No. You shouldn't count $2222$ four times.

  • 0
    If I have _ _ _ _. each has say 4 options, then you have $4^4$ passcodes, but does this count $5555$ 4 times as well?2017-01-26
  • 0
    No. It only counts it once. I get $4^4$ by saying "you have $4$ choices for the first slot, $4$ for the second, and so on". What makes you think we should count $5555$ more than once?2017-01-26
  • 0
    Try two slots. Then I claim there are $4^2=16$. Indeed, they are $22,23,25,27,32,33,35,37,52,53,55,57,72,73,75,77$. Note that we do not count $55$ twice.2017-01-26