(n)
Generates the alternating group of order n, An.

    Examples
    ========

    >>> from sympy.combinatorics.permutations import Permutation
    >>> Permutation.print_cyclic = True
    >>> from sympy.combinatorics.generators import alternating
    >>> list(alternating(3))
    [Permutation(2), Permutation(0, 1, 2), Permutation(0, 2, 1)]
Generates the alternating group of order n, An.
Generates the alternating group of order n An .
def alternating(n):
    """
    Generates the alternating group of order n, An.

    Examples
    ========

    >>> from sympy.combinatorics.permutations import Permutation
    >>> Permutation.print_cyclic = True
    >>> from sympy.combinatorics.generators import alternating
    >>> list(alternating(3))
    [Permutation(2), Permutation(0, 1, 2), Permutation(0, 2, 1)]
    """
    for perm in variations(list(range(n)), n):
        p = Permutation(perm)
        if p.is_even:
            yield p
def alternating ( n ) : for perm in variations ( list ( range ( n ) ) , n ) : p = Permutation ( perm ) if p . is_even : yield p