(self)
Test if the group is nilpotent.

        A group ``G`` is nilpotent if it has a central series of finite length.
        Alternatively, ``G`` is nilpotent if its lower central series terminates
        with the trivial group. Every nilpotent group is also solvable
        ([1], p.29, [12]).

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import (SymmetricGroup,
        ... CyclicGroup)
        >>> C = CyclicGroup(6)
        >>> C.is_nilpotent
        True
        >>> S = SymmetricGroup(5)
        >>> S.is_nilpotent
        False

        See Also
        ========

        lower_central_series, is_solvable
Test if the group is nilpotent.
Test if the group is nilpotent .
def is_nilpotent(self):
        """Test if the group is nilpotent.

        A group ``G`` is nilpotent if it has a central series of finite length.
        Alternatively, ``G`` is nilpotent if its lower central series terminates
        with the trivial group. Every nilpotent group is also solvable
        ([1], p.29, [12]).

        Examples
        ========

        >>> from sympy.combinatorics.named_groups import (SymmetricGroup,
        ... CyclicGroup)
        >>> C = CyclicGroup(6)
        >>> C.is_nilpotent
        True
        >>> S = SymmetricGroup(5)
        >>> S.is_nilpotent
        False

        See Also
        ========

        lower_central_series, is_solvable

        """
        if self._is_nilpotent is None:
            lcs = self.lower_central_series()
            terminator = lcs[len(lcs) - 1]
            gens = terminator.generators
            degree = self.degree
            identity = _af_new(list(range(degree)))
            if all(g == identity for g in gens):
                self._is_solvable = True
                self._is_nilpotent = True
                return True
            else:
                self._is_nilpotent = False
                return False
        else:
            return self._is_nilpotent
def is_nilpotent ( self ) : if self . _is_nilpotent is None : lcs = self . lower_central_series ( ) terminator = lcs [ len ( lcs ) - 1 ] gens = terminator . generators degree = self . degree identity = _af_new ( list ( range ( degree ) ) ) if all ( g == identity for g in gens ) : self . _is_solvable = True self . _is_nilpotent = True return True else : self . _is_nilpotent = False return False else : return self . _is_nilpotent