# How to build a matrix $M \in Mat_{1000 \times 1000}(\mathbb{R})$ to represent all possible combinations of a 6 digits code

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.

• Do you need them ordered? Otherwise a set might be better than a matrix. Or a tree/graph. – Emil Nov 12 '18 at 7:00
• 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. – Jneven Nov 12 '18 at 7:09
• If you do not need to know where the digits are, perhaps a set of multisets should be chosen? – Emil Nov 12 '18 at 7:25
• how do I construct such one? – Jneven Nov 12 '18 at 7:25
• I would do a couple of for loops. – Emil Nov 12 '18 at 7:35

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?