Variation of a $9$-digit string with digits from $0 – 9$

combinatorics

I've got an exercise where I have a $9$ digit string e.g. $123456789$ with every digit randomly between $0$ and $9$.
I want to find out how many combinations there are without repetition of whole string
For example:

  • $123456789$
  • $132456789$
  • $213456789$

  • should be counted as one because they have the same occurrence of numbers.

I've found this formula, but I don't think it's correct:

$${n+k – 1 \choose n}$$

If something is unclear just let me know and I'm happy for every help 🙂

EDIT:
Thank you all very much. It seems that

$${n+k – 1 \choose n}$$

was after all the right formula. To doublecheck I've implemented it in JS with a simple for loop, maybe someone wants to try it

const zeroPad = (num, places) => String(num).padStart(places, '0');

let count = [];
// pretty slow because of the big number
for (let i = 0; i <= 999999999; i++) {
  let padded = zeroPad(i, 9);
  padded = padded.split('').sort().join('');
  if (count.includes(padded)) {
    continue;
  } else {
    count.push(padded);
  }
}

console.log(count.length);

Best Answer

From your description, it seems clear that it is combinations, not permutations that you are seeking.

Consider $10$ distinct bins numbered $0\; through\;9$ in which we are to put $9$ identical balls, with the balls getting labelled according to the bin in which they are put.

This is a classic stars and bars problem which will have the solution $$\binom{9+10-1}9 = 48620$$