Programming with GAP: Instructor Notes


First session with GAP

  1. Solution of the challenge: Filtered( elts, g -> 2^g = 2 ); and Filtered( elts, g -> (1,2)^g = (1,2) );.

Some more GAP objects

  1. Solution of the challenge: r:=c[1]; for i in [2..Length(c)] do if c[i][2]>r[2] then r:=c[i]; fi; od; r;

Functions in GAP

Using regression tests

  1. Solution of the challenge: Sum(List(Filtered([1..2000], n -> not IsPrimePowerInt(n)),NrSmallGroups)); NrSmallGroups(1536); last2-last;. In addition to SmallGroup(105,1) and SmallGroup(357,1), another group is SmallGroup(1785,1).

Attributes and Methods

  1. Ideas for the challenge: try k:=1 and then k:=k+1;n:=2^k;AvgOrdOfCollection(DihedralGroup(n));time;AvgOrdOfGroup(DihedralGroup(n));time;. Even for k=20, the 1st function takes about 15s and the 2nd - about 115s on a MacBook Pro.