I'm trying to find the formula to calculate the amount of permutations for $x$ number of elements that can repeat, $y$ number of elements that cannot repeat, and $z$ number of spaces/slots. So far I figured out the parts for when only $x$ elements are included: $x^z$, and when all elements are included but none act as repeating: $\frac{(x+y)!}{(x+y-z)!}$, which are basic derivations of known combinations and permutations formulas. These added together plus the cases where repeatable and non-repeatable elements are both present, and repeatable elements are repeating at least once would be the total number of permutations, but I can't seem to narrow down the formula for that part. Any guidance would be appreciated.

New contributor
user2632413 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    $\begingroup$ Not clear what you mean ... So you have $y$ singleton elemnets & $x$ elements that appear twice ? ... and you then want to put these into $z$ slots ? $\endgroup$ – Donald Splutterwit 2 days ago
  • $\begingroup$ @user2642413 let z=7, manually try small values for x and y, and look for a pattern. $\endgroup$ – user2661923 2 days ago
  • $\begingroup$ y singleton elements, and x elements that can appear up to z amount of times. And yes, z slots. and I tried x=2 y=2 for z = 4 and manually took about 2hrs. $\endgroup$ – user2632413 2 days ago
  • $\begingroup$ $\sum\limits_{i=0}^z i! \dbinom{z}{i} \dbinom{y}{i} x^{z-i}$ should do it (proof: split the count according to what positions the $y$ nonrepeating elements are placed in). I don't think there is a simpler form. $\endgroup$ – darij grinberg 2 days ago
  • $\begingroup$ ((x+y)^z)/((x+y)/y) seems to be a simpler form. Treat all elements as repeating, and then divide by the proportion of those that include a nonrepeating acting as a repeating. $\endgroup$ – user2632413 2 days ago

Your Answer

user2632413 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.