0
$\begingroup$

Given the digits 0-9 (10 digits), I was asked how many possible combinations of a 6 digits code can be build. Answer is obviously $10^6$. Then I was being asked further questions, and in order to be able to develop an intuition for this kind of questions, I would like to construct a matrix that will represent all possible codes.

More specifically: thr matrix will provide more information regarding special code combinations, such as the number of codes that contain the digit $0$ exactly once, or number of codes containing the digits $0$ and $2$ at least one.

My question is in what way this matrix should be constructed, meaning what are the cordinates that will cover all $10^6$ possible code combinations.

$\endgroup$
  • $\begingroup$ Do you need them ordered? Otherwise a set might be better than a matrix. Or a tree/graph. $\endgroup$ – Emil Nov 12 '18 at 7:00
  • $\begingroup$ I'm interested in specific code combinations - for example - all code combinations for which the digit $0$ appear only once, or all combinations for which the digit $0$ appear at least twice, or all the code combinations for which the digits $0$ and $2$ appear exactly once - and so on. $\endgroup$ – Jneven Nov 12 '18 at 7:09
  • $\begingroup$ If you do not need to know where the digits are, perhaps a set of multisets should be chosen? $\endgroup$ – Emil Nov 12 '18 at 7:25
  • $\begingroup$ how do I construct such one? $\endgroup$ – Jneven Nov 12 '18 at 7:25
  • $\begingroup$ I would do a couple of for loops. $\endgroup$ – Emil Nov 12 '18 at 7:35
1
$\begingroup$

Not sure if you require matrices. This seems to be more combinatorics. For combinations of codes where 0 appears once, we want 1 zero and 5 non zero. Which is $9^5$ times 6 for the 6 places where 0 could be. Was this helpful?

$\endgroup$

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.