Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Count the number of distinct necklaces made with beads of different colors
| ResourceFunction["NecklaceCount"][group,n] gives the number of distinct necklaces that can be constructed with beads of n colors using operations defined by group. | 
The number of distinct (fixed) necklaces of six beads in three colors:
| In[1]:= | ![ResourceFunction["NecklaceCount"][CyclicGroup[6], 3]](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/0cf745b912420d52.png) | 
| Out[1]= |  | 
The number of bracelets of five beads in two colors:
| In[2]:= | ![ResourceFunction["NecklaceCount"][DihedralGroup[5], 2]](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/775d8a889c138efb.png) | 
| Out[2]= |  | 
The necklace count can be obtained from CycleIndexPolynomial for the corresponding group:
| In[3]:= | ![npoly = CycleIndexPolynomial[CyclicGroup[6], Array[Subscript[a, ##] &, 6]]](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/7111e6b703ffa5d5.png) | 
| Out[3]= |  | 
| In[4]:= | ![npoly /. Subscript[a, i_] -> r^i + g^i + b^i /. {r -> 1, g -> 1, b -> 1}](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/11d517cb3bce1b86.png) | 
| Out[4]= |  | 
| In[5]:= | ![ResourceFunction["NecklaceCount"][CyclicGroup[6], 3]](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/25448a4718415a1c.png) | 
| Out[5]= |  | 
Or for a bracelet:
| In[6]:= | ![bpoly = CycleIndexPolynomial[DihedralGroup[5], Array[Subscript[a, ##] &, 5]]](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/51a4c67688dbf43a.png) | 
| Out[6]= |  | 
| In[7]:= | ![bpoly /. Subscript[a, i_] -> b^i + w^i /. {b -> 1, w -> 1}](https://www.wolframcloud.com/obj/resourcesystem/images/2fd/2fdd7f3a-ece9-4fa2-b8b4-465a0d123f61/40a928dcf5792f05.png) | 
| Out[7]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License