necklace | R Documentation |
Necklace and bracelet problems in combinatorics.
necklace(k, n) bracelet(k, n)
k |
The size of the set or alphabet to choose from. |
n |
the length of the necklace or bracelet. |
A necklace is a closed string of length n
over a set of size
k
(numbers, characters, clors, etc.), where all rotations are
taken as equivalent. A bracelet is a necklace where strings may also
be equivalent under reflections.
Polya's enumeration theorem can be utilized to enumerate all necklaces
or bracelets. The final calculation involves Euler's Phi or totient
function, in this package implemented as eulersPhi
.
Returns the number of necklaces resp. bracelets.
https://en.wikipedia.org/wiki/Necklace_(combinatorics)
necklace(2, 5) necklace(3, 6) bracelet(2, 5) bracelet(3, 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.