The guide
Why dividing by the number of beads fails: counting necklaces and bracelets by symmetry
Rotations and flips merge arrangements into classes, and the honest count of classes is an average of what each symmetry leaves unchanged.
- 14 and 13 necklaces and bracelets, 6 beads in 2 colours
- 130 and 92 necklaces and bracelets, 6 beads in 3 colours
- 10 what 64 divided by 6 rounds down to; the true count is 14
- 57 colourings of a cube's faces in three colours
- 309 digits the necklace count for 200 beads in 36 colours
Read the full guide Fold the guide
Thread six beads onto a string, each one red or green, and tie the ends. How many different necklaces can you make? Two red beads side by side give the same necklace whichever pair you call the first. The honest answer is 14. The tempting answer, 2 to the sixth power divided by 6, is 64 divided by 6, which is not even a whole number.
That gap is the whole subject. Counting arrangements that count as the same when you rotate or flip them cannot be done by dividing the total by the number of symmetries, because some arrangements are unchanged by some symmetries. Burnside’s lemma repairs the division, and it does so with a single idea: average, over the symmetries, how many arrangements each one leaves alone.
Necklaces, bracelets and what counts as the same
The Wikipedia article on necklaces defines a k-ary necklace of length n as an equivalence class of strings of n characters over an alphabet of k letters, with every rotation treated as equivalent. Picture n beads in a circle and k colours to choose from. A bracelet is a necklace that may also be turned over, so a string and its reverse fall in one class. The article adds that a necklace is sometimes called a fixed necklace and a bracelet a turnover or free necklace.
The distinction shows up in small cases. The same article pictures three bracelets made from 3 red and 3 green beads, one of them chiral, meaning it differs from its own mirror image, so the three bracelets make 4 necklaces. With 2 red, 2 yellow and 2 green beads there are 11 bracelets and 16 necklaces. Each chiral bracelet is two necklaces that are mirror images of each other, and the 16 tiles of one well-known tile game correspond to those 16 necklaces.
A second distinction matters for counting. A necklace is aperiodic when none of its rotations short of a full turn gives back the same string, so the class has exactly n members. An aperiodic necklace holds exactly one Lyndon word, a string strictly smaller than all of its rotations, which is why Lyndon words serve as representatives of aperiodic necklaces.
Averaging what each symmetry leaves alone
Burnside’s lemma, as the Wikipedia article states it, says the number of orbits of a finite group acting on a set equals the average number of points fixed by a group element. Cauchy and Frobenius discovered it, and it became well known after William Burnside quoted it. Here the group is the rotations, or the rotations and flips, and the points are all colourings.
Take 3 beads and 2 colours. There are 8 strings, and the article lists the four necklaces as 000, 001, 011 and 111. The identity fixes all 8 strings. Each of the two other rotations fixes only 000 and 111, so 2 each. The average is 8 plus 2 plus 2, divided by 3, which is 4. For 4 beads the article gets 16 plus 2 plus 4 plus 2, divided by 4, which is 6.
Notice why division alone fails. Of the 8 strings above, 000 and 111 are each their own class of size one, while the other six sit in classes of three. Dividing 8 by 3 would pretend every class has three members. The fixed-point average corrects for the short classes automatically, because a short class is exactly one that some rotation fixes.
A rotation by r places splits the n beads into gcd(n, r) cycles, and a colouring is fixed exactly when the beads in each cycle share a colour. So that rotation fixes k to the power gcd(n, r) colourings. Group the rotations by that gcd and the average becomes the divisor sum in the necklace article: one over n, times the sum over divisors d of n of phi(d) times k to the power n over d. Here phi is Euler’s totient function, which counts the positive integers up to d that share no factor with d.
The worked example you can reproduce
Take 6 beads in 2 colours. The identity fixes 2 to the sixth, which is 64. The rotation by 3 places has gcd 3 and fixes 2 cubed, which is 8. The two rotations by 2 and 4 places have gcd 2 and fix 4 each. The two by 1 and 5 places have gcd 1 and fix 2 each. The sum is 64 plus 8 plus 8 plus 4, which is 84, and 84 divided by 6 is 14 necklaces. Plain division gets 64 divided by 6, which is 10 with a remainder of 4, so it misses by four.
The sequence of necklace counts for two colours in the OEIS lists 1, 2, 3, 4, 6, 8, 14 and 20 for lengths 0 to 7, and gives 352 for length 12. Those match the table: the entry for length 6 is 14.
Now allow flips. The dihedral group, the symmetries of a regular polygon with n corners, has order 2n, so 6 beads have 12 symmetries. The article on necklaces says the bracelet count is half the necklace count plus a correction: for even n it is a quarter of (k plus 1) times k to the power n over 2, and for odd n it is half of k to the power (n plus 1) over 2. For 6 beads in 2 colours that is 7 plus 6, which is 13 bracelets.
The flips also fit the average. Three flips run through two opposite beads, and each fixes 2 to the fourth power, which is 16 colourings. Three run through two opposite gaps and each fixes 8. The flips add 48 plus 24, which is 72. The full sum is 84 plus 72, which is 156, and 156 divided by 12 is 13. The two-colour bracelet sequence in the OEIS gives the same 13, and 224 for twelve beads.
Leaving the flips out is the second common mistake. With rotations alone the count stays at 14, which counts a ring and its mirror image as different things. Both errors fail in the tool: set 6 beads and 2 colours and the working shows 64 divided by 6, with a remainder of 4, beside the true 14, and the bracelet row shows the drop to 13.
Aperiodic necklaces and the cube
The aperiodic count has its own formula. The necklace article gives Moreau’s function: one over n, times the sum over divisors d of n of the Moebius function mu(d) times k to the power n over d. For 6 beads in 2 colours that is 64 minus 8 minus 4 plus 2, which is 54, and 54 divided by 6 is 9. The OEIS sequence of binary Lyndon words gives 9 for length 6.
The two counts tie together. Every necklace is a shorter aperiodic necklace repeated, so the necklaces of length n are the aperiodic ones of every length that divides n, added up. For n equal to 6 the divisors 1, 2, 3 and 6 give 2, 1, 2 and 9, and 2 plus 1 plus 2 plus 9 is the necklace count 14. The tool checks that identity for every length below 40 and up to five colours.
The same averaging counts the colourings of the six faces of a cube. The rotation group of a cube has 24 elements. The identity fixes k to the sixth power. Six quarter turns about face axes fix k cubed, three half turns about face axes fix k to the fourth, eight third turns about corner axes fix k squared, and six half turns about edge axes fix k cubed.
Averaging gives (k to the sixth, plus 3 k to the fourth, plus 12 k cubed, plus 8 k squared) divided by 24. With three colours that is 1,368 divided by 24, which is 57, the figure in the Burnside article. The OEIS entry for cube colourings lists 1, 10, 57 and 240 for one to four colours and gives the cycle index that the table above follows.
What the numbers can be trusted for, and what they cannot
Counts grow fast. A necklace of 60 beads in 2 colours has 19,215,358,428,046,176 classes, well above the largest safe integer of an ordinary floating-point number, which the MDN page on BigInt shows as 9007199254740991. The tool therefore keeps every count as a BigInt, an integer with no fixed size, and prints it in full. At the page’s limits of 200 beads and 36 colours the necklace count runs to 309 digits.
Exactness is checked in two ways. Each sum must divide evenly by the group size, which it does only when the arithmetic is right. And for small cases the tool counts every colouring one by one, takes the smallest image of each under the symmetries, and compares the number of classes with the formula. The Wikipedia article notes that a standard rotation can be picked by reading a string as a number, and that choosing the greatest avoids clashes between lengths. This page always compares strings of one fixed length, so it takes the smallest.
The heavier work runs in a Web Worker. The MDN article describes this as running a script operation in a background thread separate from the main thread, so a long task cannot freeze the page, and a cancel button stops it.
The limits are plain. The tool counts colourings with any number of beads of each colour, not colourings with a fixed number of each, which is a separate multinomial count. It lists canonical forms only up to 12 beads and 4 colours, and it handles two symmetry groups: rotations with flips for rings, and the 24 rotations of a cube. The Polya enumeration theorem generalises Burnside’s lemma, and the necklace article uses its pattern inventory to count by the number of beads of each colour. That refinement is outside this page.
Sources
Every source consulted for this guide. Links checked November 10, 2026.
- Necklace (combinatorics) - Wikipedia Wikipedia (CC BY-SA 4.0)
- Burnside's lemma - Wikipedia Wikipedia (CC BY-SA 4.0)
- Polya enumeration theorem - Wikipedia Wikipedia (CC BY-SA 4.0)
- Lyndon word - Wikipedia Wikipedia (CC BY-SA 4.0)
- Euler's totient function - Wikipedia Wikipedia (CC BY-SA 4.0)
- Dihedral group - Wikipedia Wikipedia (CC BY-SA 4.0)
- A000031 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
- A000029 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
- A001037 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
- A047780 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
- BigInt - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
- Web Workers API - Web APIs | MDN MDN Web Docs (CC BY-SA 2.5 or later)