Esempio n. 1
0
def gap_gen_to_string(g):
  seen = set()
  s = ""
  f = StringIO.StringIO()
  
  for i in xrange(gap.SmallestMovedPointPerm(g),
                  gap.LargestMovedPointPerm(g) + 1):
    i = gap(i)
    if int(i) in seen:
      continue
    
    a = i
    seen.add(int(a))  # need to convert to an int instead of a gap int
    cycle = [a]
    
    while i != a**g:
      a = a**g
      seen.add(int(a))
      cycle.append(a)
    
    if len(cycle) > 1:
      f.write("(%s)" % ' '.join([str(a) for a in cycle]))

  return f.getvalue()
Esempio n. 2
0
 def gapgroupnt(self):
     if int(self.n()) == 1:
         G = gap.SmallGroup(1, 1)
     else:
         G = gap('Group([' + self.generator_string() + '])')
     return G