0

Now the problem i am facing is that how do i consider the loops for calculating pair wise, three -wise , four - wise etc, because if the size is 2 i need to calculate a1+a2-a1*a2. ,where a1 is the no. of elements in set i to N divisible by 1st no of the second set , and so on, thus 1 loop

for n=3

a1+a2+a3-(a1*a2) -(a1*a3)-(a2*a3)-(a1*a2*a3) so 2 loops .

similarly for 4 , there should be 4 loops and so on thus rending the programme very lenghty and inefficient , so how should i implement it?