The algorithm used in this file comes from
Return the combinatorial class of necklaces with evaluation content.
A necklace is a list of integers that such that the list is the smallest lexicographic representative of all the cyclic shifts of the list.
See also
INPUT:
EXAMPLES:
sage: Necklaces([2,1,1])
Necklaces with evaluation [2, 1, 1]
sage: Necklaces([2,1,1]).cardinality()
3
sage: Necklaces([2,1,1]).first()
[1, 1, 2, 3]
sage: Necklaces([2,1,1]).last()
[1, 2, 1, 3]
sage: Necklaces([2,1,1]).list()
[[1, 1, 2, 3], [1, 1, 3, 2], [1, 2, 1, 3]]
sage: Necklaces([0,2,1,1]).list()
[[2, 2, 3, 4], [2, 2, 4, 3], [2, 3, 2, 4]]
sage: Necklaces([2,0,1,1]).list()
[[1, 1, 3, 4], [1, 1, 4, 3], [1, 3, 1, 4]]
Bases: sage.combinat.combinat.CombinatorialClass
Necklaces with a fixed evaluation (content).
INPUT:
Return the number of integer necklaces with the evaluation content.
The formula for the number of necklaces of content
a composition of
is:
where is the Euler
function.
EXAMPLES:
sage: Necklaces([]).cardinality()
0
sage: Necklaces([2,2]).cardinality()
2
sage: Necklaces([2,3,2]).cardinality()
30
sage: Necklaces([0,3,2]).cardinality()
2
Check to make sure that the count matches up with the number of necklace words generated.
sage: comps = [[],[2,2],[3,2,7],[4,2],[0,4,2],[2,0,4]]+Compositions(4).list()
sage: ns = [ Necklaces(comp) for comp in comps]
sage: all( [ n.cardinality() == len(n.list()) for n in ns] )
True
Return the content (or evaluation) of the necklaces.
TESTS:
sage: N = Necklaces([2,2,2])
sage: N.content()
[2, 2, 2]
Deprecated in trac ticket #17436. Use content() instead.
TESTS:
sage: N = Necklaces([2,2,2])
sage: N.e
doctest:...: DeprecationWarning: e attribute is deprecated. Use the content method instead
See http://trac.sagemath.org/17436 for details.
[2, 2, 2]