Let's begin with a simple example. Now, we have a list,
k1 and k2 are some elements of the list0. If |k1-k2|==2, then the elements k1 and k2 can interchange their positions.(Namely, 1 and 3 can echange; 2 and 4 can exchange) With this condition, we can get a new list including 4 elements,
In the listnew, the no-exchange list0 is also included. And the sequence of the elements in the listnew are not important.
My problem is, if we consider,
and the exchange condition is,
|k1-k1|==4 Or |k1-k1|==8 Or |k1-k1|==12
How to get the listnew by using a general and simple way ?