4
$\begingroup$

A pin code is 5 digits long, using only the numbers 1-9 with no repeats. How many combinations are there if two of the numbers must be prime and two must be square.

The primes are 2, 3, 5 and 7 (so there must be two of these) Squares are 1, 4, and 9 (two of these) The remaining digit must be a 6 or 8

I think the right answer is 8640 What I think I've got so far is 4P2 * 3P2 * 5! = 8640 I'm not sure if that's correct. My thinking was you have 2 out of 4 primes and 2 out of 3 squares. The 5! for the different ordering of 5 digits. But I haven't done anything about the remaining digit (either 6 or 8).

Is anyone able to offer a better explanation of how to work this out.

Thank You

Edit: I realised I haven't clarified whether it is exactly 2 or at least 2 primes (same with squares). I don't have the question with me anymore so I don't remember. My hunch is it said exactly 2 primes and exactly 2 squares.

$\endgroup$
  • 2
    $\begingroup$ $\,^4 C_2 \times \,^3 C_2 \times \,^2 C_1 \times 5! = 4320$ would be more plausible, but it is unclear to me whether $23549$ would satisfy the conditions in the question: if so there would be more $\endgroup$ – Henry Nov 30 '18 at 10:39
  • $\begingroup$ @Henry I updated the question. I realised I didn't clarify this point. I think 23549 wouldn't count. $\endgroup$ – NumberCruncher Nov 30 '18 at 10:43
4
$\begingroup$

The P means you've already designated a first and a second prime, and a first and a second square. Thus $5!$ double-counts a lot of orderings. Use C instead, and this is fine.

And the $8$ or $6$ you take care of in exactly the same way: you can choose one of them in $_2C_1$ ways.

Thus the final answer is $$ _4C_2{}\cdot{} _3C_2\cdot{} _2C_1\cdot 5! $$

$\endgroup$
  • $\begingroup$ This assumes that you need exactly two primes and exactly two squares. If you can have three, then count the number of codes with three primes, two squares and with two primes, three squares the same way and add them together. $\endgroup$ – Arthur Nov 30 '18 at 10:42
  • $\begingroup$ I clarified this in my edit. Sorry I overlooked this when I posted. Would the answer be 8640 if the question was at least 2 primes or at least 2 squares. $\endgroup$ – NumberCruncher Nov 30 '18 at 10:45
  • $\begingroup$ @NumberCruncher I get the same digits, but in a different order: $6480$. $\endgroup$ – Arthur Nov 30 '18 at 11:08
  • $\begingroup$ Yes, that's probably it. The answer must have been 6480 not 8640 as I misremembered it. How did you get that please? Is this for at least 2 primes and at least 2 squares? $\endgroup$ – NumberCruncher Nov 30 '18 at 13:10
  • $\begingroup$ @NumberCruncher I followed my first comment. The easiest way is to do all three cases separately. $\endgroup$ – Arthur Nov 30 '18 at 13:31

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.