How many 5 digit numbers with at least two digits prime and two digits square?

57 Views Asked by At

How many 5 digit numbers with at least two digits prime and at least two digits square?

All digits are different and non-zero.

So I have seen this problem online and can’t find a solution so just wondering (i) if I’m correct and (ii) if there are any other ways out there.

My solution:

At least two digits prime and two digits square means that at most one digit has neither of these properties (N). We have 3 square (S) numbers and 4 prime numbers (P) in the range also.

Hence the cases are

NSSPP -> $2 \times 3 \times 2 \times 4 \times 3 =144$

SSSPP -> $3 \times 2 \times 1 \times 4 \times 3 =72$

SSPPP -> $3 \times 2 \times 4 \times 3 \times 2 =144$

Total = $360$

How’s my solution looking?

If it’s wrong why? If correct, are there any other methods

Edit: changes 6 to 2 in the first line as only neither digits are 6 and 8

1

There are 1 best solutions below

0
On BEST ANSWER

As you observe we have three cases:

SSPPN: In order to count this typo we do the following:

  • Choose $2$ digits square from the set of digits square: you can do this in $\binom{3}{2}$ ways.
  • Choose $2$ digits prime from the set of digits prime: you can do this in $\binom{4}{2}$ ways.
  • Choose $1$ digits neither from the set of digits neither: you can do this in $\binom{2}{1}$ ways.
  • Since the digits are all different, you can permute them as you want: so you have $5!$ ways to permute.

So for this case you have: \begin{equation} \binom{3}{2}\cdot \binom{4}{2} \cdot \binom{2}{1} \cdot 5! = 4320 \end{equation}

And

SSSPP: You have:

  • $3$ digits square from the set of digits square: you can do this in $\binom{3}{3}$ ways.
  • $2$ digits prime from the set of digits prime: you can do this in $\binom{4}{2}$ ways.
  • Since the digits are all different, you can permute them as you want: so you have $5!$ ways to permute.

So for this case you have: \begin{equation} \binom{3}{3}\cdot \binom{4}{2} \cdot 5! = 720 \end{equation}

And

SSPPP: In order to count this typo we do the following:

  • $2$ digits square from the set of digits square: you can do this in $\binom{3}{2}$ ways.
  • $3$ digits prime from the set of digits prime: you can do this in $\binom{4}{3}$ ways.
  • Since the digits are all different, you can permute them as you want: so you have $5!$ ways to permute.

So for this case you have: \begin{equation} \binom{3}{2}\cdot \binom{4}{3} \cdot 5! = 1440 \end{equation}

So the result is $4320+720+1440=6480$.