n + k k d d gcd(n,k) j without a ecting the number of necklaces). This is a classical formula (Luca , [3, pp. 501{503], Riordan, [6, p. 162]). It can also be easi and show how they correspond to necklaces. Let the variables on whi h G1 acts be labeled x0, x1, . . . , xn 1. If we xl0xl1 0 1, Given an non-negative integer n, return the number of distinct reversible primitive binary necklaces of length n. Input and output as a single integer each. The first few terms of this sequence are 1, 2, 1, 2, 3, 6, 8, 16, 24, 42, 69, 124, 208, 378, 668, 1214, 2220, 4110, 0-indexed. This is OEIS A001371., Number of degree-n irreducible polynomials over GF (2); number of n-bead necklaces with beads of 2 colors when turning over is not allowed and with primitive period n; number of binary Lyndon words of length n., For example, with n = 4 n = 4, we count only 0111 0111 and 0011 0011. The former counts all necklaces with one zero (anywhere), and (by taking complements) three zeroes. The latter counts all necklaces with two adjacent zeroes, and two adjacent ones. What we don't count are 1111 1111 and 1010 1010., In fact, the number of colorful bracelets with n beads in three colors appears in the On-line Encyclopedia of Integer Sequences (OEIS) as sequence A114438, which is the “Number of Barlow packings that repeat after n (or a divisor of n) layers.”, In the binary necklace 01010, four beads are next to a zero and three are next to a one, yielding the pair (4,3)..