My friend asked me an interesting question yesterday: Say you have six names, which you have to sort in six groups. The order of the names must always be different between the groups, such that:
| Group 1 | Group 2 | Group 2' |
|---|---|---|
| A | F | E |
| B | E | F |
| C | D | D |
| D | C | C |
| E | B | B |
| F | A | A |
The set of Group 1 and Group 2 is allowed, but the set of Group 1 and Group 2' is not, as EF in that order is occurring in both groups. Also, no name must appear in the same place as in the other groups (eg. no F in row 2 of two or more different groups). Is it possible to make six different groups fulfilling these requirements?
I have solved it by making a MATLAB program (code below), but I would like to see how it can be proved mathematically whether or not it is possible.
clear all
number=6;
x = perms(1:number);
row=1; %start row
running=0;
while running==0||(row<height(y))
if running==1
x=y;
clear y;
end
running=1;
for r=row+1:height(x)
for i=1:(number-1)
for j=1:(number-1)
if (x(row,i:i+1) == x(r,j:j+1))
x(r,:)=100;
end
end
end
end
for r=row+1:height(x)
for i=1:number
for j=1:number
if (x(row,i) == x(r,i))
x(r,:)=100;
end
end
end
end
l=1;
for k=1:height(x)
if x(k,1)<100
y(l,:)=x(k,:);
l=l+1;
end
end
row=row+1;
end
disp(y)