[GAP Forum] some question on sets

Levie Bicua lee_bkua at yahoo.com
Mon Apr 27 06:35:37 BST 2009


Dear forum,
 
Is it possible to group the elements of a set into subsets of 6 elements each? Suppose I
want the set T:=[elt1,elt2,elt3, ..., elt42] into S:=[[elt1 to elt6],[elt7 to elt 12], ..., [elt37 to
elt42]].. For the set 
T:=[[ (), (2,3), (1,2) ], [ (), (2,3), (1,3) ], [ (), (1,2), (2,3) ], 
[ (), (1,2), (1,3) ], [ (), (1,3), (2,3) ],[ (), (1,3), (1,2) ], 
[ (2,3), (), (1,2) ], [ (2,3), (), (1,3) ], [ (1,2), (), (2,3) ], 
[ (1,2), (), (1,3) ],[ (1,3), (), (2,3) ], [ (1,3), (), (1,2) ], 
[ (2,3), (2,3), (1,2) ], [ (2,3), (2,3), (1,3) ], [ (1,2), (1,2), (2,3) ], 
[ (1,2), (1,2), (1,3) ], [ (1,3), (1,3), (2,3) ], [ (1,3), (1,3), (1,2) ], 
[ (2,3), (1,2), () ], [ (2,3), (1,3), () ], [ (1,2), (2,3), () ], 
[ (1,2), (1,3), () ], [ (1,3), (2,3), () ], [ (1,3), (1,2), () ], 
[ (2,3), (1,2), (2,3) ], [ (2,3), (1,3), (2,3) ], [ (1,2), (2,3), (1,2) ], 
[ (1,2), (1,3), (1,2) ], [ (1,3), (2,3), (1,3) ], [ (1,3), (1,2), (1,3) ], 
[ (2,3), (1,2), (1,2) ], [ (2,3), (1,3), (1,3) ], [ (1,2), (2,3), (2,3) ], 
[ (1,2), (1,3), (1,3) ], [ (1,3), (2,3), (2,3) ], [ (1,3), (1,2), (1,2) ], 
[ (2,3), (1,2), (1,3) ], [ (2,3), (1,3), (1,2) ], [ (1,2), (2,3), (1,3) ], 
[ (1,2), (1,3), (2,3) ], [ (1,3), (2,3), (1,2) ], [ (1,3), (1,2), (2,3) ] ];
 
I used 
 
S:=[T{[1..6]},T{[7..12]},T{[13..18]},T{[19..24]},T{[25..30]},T{[31..36]},T{[37..42]}];
 
and it returned
 
S:=[
[[ [ (), (2,3), (1,2) ], [ (), (2,3), (1,3) ], [ (), (1,2), (2,3) ], 
 [ (), (1,2), (1,3) ], [ (), (1,3), (2,3) ], [ (), (1,3), (1,2) ]], 
[[ (2,3), (), (1,2) ], [ (2,3), (), (1,3) ], [ (1,2), (), (2,3) ], 
 [ (1,2), (), (1,3) ], [ (1,3), (), (2,3) ], [ (1,3), (), (1,2) ]], 
[[ (2,3), (2,3), (1,2) ], [ (2,3), (2,3), (1,3) ], [ (1,2), (1,2), (2,3) ], 
 [ (1,2), (1,2), (1,3) ], [ (1,3), (1,3), (2,3) ], [ (1,3), (1,3), (1,2) ]], 
[[ (2,3), (1,2), () ], [ (2,3), (1,3), () ], [ (1,2), (2,3), () ], 
 [ (1,2), (1,3), () ], [ (1,3), (2,3), () ], [ (1,3), (1,2), () ]], 
[[ (2,3), (1,2), (2,3) ], [ (2,3), (1,3), (2,3) ], [ (1,2), (2,3), (1,2) ], 
 [ (1,2), (1,3), (1,2) ], [ (1,3), (2,3), (1,3) ], [ (1,3), (1,2), (1,3) ]], 
[[ (2,3), (1,2), (1,2) ], [ (2,3), (1,3), (1,3) ], [ (1,2), (2,3), (2,3) ], 
 [ (1,2), (1,3), (1,3) ], [ (1,3), (2,3), (2,3) ], [ (1,3), (1,2), (1,2) ]], 
[[ (2,3), (1,2), (1,3) ], [ (2,3), (1,3), (1,2) ], [ (1,2), (2,3), (1,3) ], 
 [ (1,2), (1,3), (2,3) ], [ (1,3), (2,3), (1,2) ], [ (1,3), (1,2), (2,3) ]] ];
 
which is exactly what I want, but the method is not that efficient.
I wonder if there is a more efficient way of doing this.
 
Levi


      


More information about the Forum mailing list