aplicandolo a tu código deberías de tener algo así:
Código Delphi
[-]
function ValorCombinacion(list:TStrings):Int64;
var
elemento:Byte;
i: Integer;
begin
result := 0;
with list do
for i := 0 to Count - 1 do begin
elemento := StrToInt(strings[i])-1;
result := result or (Int64(1) shl elemento);
end;
end;
function obtenerComunes(res:int64):string;
var
i:integer;
begin
result:='';
for i :=0 to 49 do
if ((res and (int64(1) shl i))<>0) then
result:=result+IntToStr(i+1)+' ';
end;
...
var
res, cad1, cad2:Int64;
comunes:String;
...
for i := 0 to lista3.Items.Count -1 do
begin
with lista3 do
begin
Selected := Items[i];
cad1:= ValorCombinacion(lista3.items[i].SubItems);
end;
for j := 0 to per.Items.Count -1 do
begin
....
cad2 := ValorCombinacion(per.Items[j].SubItems);
res:=cad1 and cad2;
if (cad1 = cad2) then begin
end
else if (res <> 0) then begin
obtenerComunes(res);
end
else begin
end;
end;
Un saludo