Permutations of colored balls with restrictions Consider $N$ balls, each in one of $K$ possible colors. We denote by $n_k$ the number of balls colored in the $k$-th color ($\sum_{k=1}^K n_k =N$). Is there a known formula for the total number of permutations of the $N$ balls subject to the restriction that concatenated copies of shorter sequences should be discounted? For example, if we have $3$ $b$lue-colored balls and $3$ $r$ed-colored balls then one should not count the permutations $brbrbr$ and $rbrbrb$.

From your examples I have a hunch that you consider cyclic shifts of the same sequence as equivalent. If that is the case, the word you are looking for is "necklace".
