# How to generate non-duplicate list of tuples with integer elements {-2, 0, 2}?

How can I generate all possible non-duplicate eighttupleList where each element, $$a_i$$, can be an integer from the set {-2, 0, 2}?

eighttupleList = {{a1, a2, a3, a4, a5, a6, a7, a8}, {a3, a2, a1, a6, a5,
a4, a8, a7}, {-a1 - a3, a2, a1, -a4 - a6, a5, a4, -a7 - a8,
a7}, {a1, a2, -a1 - a3, a4, a5, -a4 - a6,
a7, -a7 - a8}, {-a1 - a3, a2, a3, -a4 - a6, a5, a6, -a7 - a8,
a8}, {a3, a2, -a1 - a3, a6, a5, -a4 - a6, a8, -a7 - a8}};


The motivation is similar to my previous thread; I want to group all elements in a list with a pattern.

inputTup = Tuples[{-2, 0, 2}, 8];
eighttupleList = {{a1, a2, a3, a4, a5, a6, a7, a8}, {a3, a2, a1, a6,
a5, a4, a8, a7}, {-a1 - a3, a2, a1, -a4 - a6, a5, a4, -a7 - a8,
a7}, {a1, a2, -a1 - a3, a4, a5, -a4 - a6,
a7, -a7 - a8}, {-a1 - a3, a2, a3, -a4 - a6, a5, a6, -a7 - a8,
a8}, {a3, a2, -a1 - a3, a6, a5, -a4 - a6, a8, -a7 - a8}};


If I can generate all eighttupleList, then I basically already gathered inputTup into the eighttupleList pattern.

I can do something like that, but some of them are duplicates.

rule = Thread[{a1, a2, a3, a4, a5, a6, a7, a8} -> #] & /@ Tuples[{-2, 0, 2}, {8}];
eighttupleList /. rule

• When you say "non-duplicate list of tuples", do you mean list of tuples such that that list does not contain the same tuple twice? Commented Mar 7 at 2:49
• Does eightTupleList[{a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_}] := {{a1, a2, a3, a4, a5, a6, a7, a8}, {a3, a2, a1, a6, a5, a4, a8, a7}, {-a1 - a3, a2, a1, -a4 - a6, a5, a4, -a7 - a8, a7}, {a1, a2, -a1 - a3, a4, a5, -a4 - a6, a7, -a7 - a8}, {-a1 - a3, a2, a3, -a4 - a6, a5, a6, -a7 - a8, a8}, {a3, a2, -a1 - a3, a6, a5, -a4 - a6, a8, -a7 - a8}}; Select[eightTupleList /@ Tuples[{-2,0,2}, 8], DuplicateFreeQ] do what you expect? Commented Mar 7 at 2:53
• I meant two eight-tuple lists do not duplicate. For example, I can do something like that, but some of them are duplicates. rule = Thread[{a1, a2, a3, a4, a5, a6, a7, a8} -> #] & /@ Tuples[{-2, 0, 2}, {8}]; eighttupleList /. rule Commented Mar 7 at 2:57
• @thorimur Sorry for the confusion. I have just updated the post to provide more details. Commented Mar 7 at 3:07
• This is still hard to follow. Do you mean like this? Map[DeleteDuplicates, eighttupleList /. rule]? This deletes duplicates in each sublist. Commented Mar 7 at 16:39