0

I have 4 different color balls B1, B2, B3 and B4 and their quantity is given by n1, n2 ,n3 and n4 respectively.

Now, I want to arrange these balls in a straight line next to each other. However, in this arrangement I want no two balls of the same color to be adjacent to each other.
ex: if there is 1 ball for each of 4 colors then answer would be 4! = 24

I'm not able to come up with a generic formula for this. Can somebody help me with this?

Update: So I went through that duplicate marked question and the answer mentioned there doesn't has any generic formula which solves my problem!

GorvGoyl
  • 151
  • You might also be interested, on your free time, to take a look at some material on the four-color-theorem – amWhy Mar 18 '17 at 14:16
  • So I went through that duplicate marked question and the answer mentioned there doesn't has any generic formula which solves my problem! – GorvGoyl Mar 18 '17 at 14:20
  • JerryGoyal The point is, as you'll find in the answer to the duplicate question, there is no "closed form solution" (i.e., no generic formula which solves your problem.) – amWhy Mar 18 '17 at 16:05
  • It's a shame the question was marked as a duplicate as I have a general method for this problem and now I am unable to submit, I would like to help but am unsure how to proceed. – N. Shales Mar 19 '17 at 12:40
  • @amWhy it is your personal opinion that there is no closed form solution but clearly that's not the case. Please avoid assuming things by yourself and open the question so that people who actually know the answer can submit. – GorvGoyl Mar 19 '17 at 13:33
  • 1
    @N.Shales I encourage you to post your solution as an answer to the question of which this is a duplicate. The question I am referring to is given in the highligted area above Jerry's question post. – amWhy Mar 19 '17 at 14:04
  • Jerry, I never gave my opinion on the matter. I linked you to the same essential question and the answer. Just because you'd like to have a solution/general formula, doesn't mean it therefore exists. You may not like that, but that's where maturity comes in to play. My point was simply that your question was asked before, and answered, and that you don't want to believe the answer. If you have any reason to doubt it, then improve your post by presenting an argument as to why a general formula exists. – amWhy Mar 19 '17 at 14:16
  • @JerryGoyal I have posted my answer to the question of which this is a duplicate (linked at the top) as suggested. The main prerequisite that I didn't explain in the answer was the concept of a regular expression: A regular expression is simply a list of valid words using the alphabet given separated by +s. The main purpose of this is to be changed into a multivariable generating function which can be used to enumerate valid words with the specified number of each letter. The "letters" in this case are the numbers 1,2,3 and 4. – N. Shales Mar 20 '17 at 00:39
  • 1
    @N.Shales thanks I'll look into this :) – GorvGoyl Mar 20 '17 at 04:28

0 Answers0