Question: Permute_locate

Hello

I need a procedure, or command, which will identify the unique sets which sum to 1 (from a permuted list).

by way of explanation:

> with(combinat);

>A := permute([1, 1, 0, 0, 0, 0, 0, 0], 8);


[[1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0],

  [1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0],

  [1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1],

  [0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0],

  [0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0],

  [0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1],

  [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0],

  [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0],

  [0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 0, 0],

  [0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0],

  [0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 0],

  [0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 1],

  [0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 1]]
  ]
One "quad" would be

> A[1], A[14], A[23], A[28];

[1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1]

(which when you add them up you get eight 1's) :

 > A[1]+A[14]+A[23]+A[28];   
                       [1, 1, 1, 1, 1, 1, 1, 1]


....there are 6 other unique quads from data set A that I would like maple to output.
 

rgds

View 2735_permute.mw on MapleNet or Download 2735_permute.mw
View file details

 

 

Please Wait...