I am interested to know if there's a way to calculate the number of (rotation agnostic) necklaces that can be produced from different colored beads, each color with its own quantity.
For instance, if I have a 3 red beads, 2 green beads and 1 blue bead, I can produce 10 distinct necklaces (see attached image).
However, other than constructing all the necklaces and counting them (which is what I did), how can I arrive at the number of distinct necklaces that can be produced with the given beads?
Note, I am looking for a general solution, where the number of colors, and the quantity of beads in each color can be given freely.
Can you help?
EDIT:
It appears that I figured out a formula that works for the majority of cases. It fails however when the quantity of all the beads has a common denominator.
So this works, unless I have 2 of each bead, or 3 of each bead. Or 2 and 4 of each bead, etc.
Can't figure out how to solve for that case though..