def SymmetricGroup(n):
 if (n == 1):
  G = PermutationGroup([Permutation([0])])
 elif (n == 2):
  G = PermutationGroup([Permutation([1, 0])])
 else:
  a = list(range(1, n))
  a.append(0)
  gen1 = _af_new(a)
  a = list(range(n))
  (a[0], a[1]) = (a[1], a[0])
  gen2 = _af_new(a)
  G = PermutationGroup([gen1, gen2])
 if (n < 3):
  G._is_abelian = True
  G._is_nilpotent = True
 else:
  G._is_abelian = False
  G._is_nilpotent = False
 if (n < 5):
  G._is_solvable = True
 else:
  G._is_solvable = False
 G._degree = n
 G._is_transitive = True
 G._is_sym = True
 return G

def SymmetricGroup ( n ) : if ( n == 1 ) : G = PermutationGroup ( [ Permutation ( [ 0 ] ) ] ) elif ( n == 2 ) : G = PermutationGroup ( [ Permutation ( [ 1 , 0 ] ) ] ) else : a = list ( range ( 1 , n ) ) a . append ( 0 ) gen1 = _af_new ( a ) a = list ( range ( n ) ) ( a [ 0 ] , a [ 1 ] ) = ( a [ 1 ] , a [ 0 ] ) gen2 = _af_new ( a ) G = PermutationGroup ( [ gen1 , gen2 ] ) if ( n < 3 ) : G . _is_abelian = True G . _is_nilpotent = True else : G . _is_abelian = False G . _is_nilpotent = False if ( n < 5 ) : G . _is_solvable = True else : G . _is_solvable = False G . _degree = n G . _is_transitive = True G . _is_sym = True return G
generates the symmetric group on n elements as a permutation group .