The five girls, named G1, G2,…G5 arranged the round-table sitting so that between each two of them there were at least two out of 12 boys , B1, B2,…B12.
In how many ways is such arrangement possible?
(In reply to
re(2): solution by Charlie)
I changed the program to assure that each of the 5 positions have at least 2 boys:
clearvars,clc
global group ct n
group=zeros(5,12);
for n=10:12
ct=0;
addon(1);
disp([n ct ct*nchoosek(12,n)*120*24])
end
function addon(wh)
global group ct n
foundempty=false;
for psn=1:5
if group(psn,1)==0
foundempty=true;
end
for i=1:size(group,2)
if group(psn,i)==0
group(psn,i)=wh;
break
end
end
if wh==n
if length(find(group(:,2)>1))==5 % this line
prms=1;
for jj=1:5
prms=prms*factorial(length(find(group(jj,:))));
end
ct=ct+prms;
end
else
addon(wh+1);
end
group(psn,i)=0;
if foundempty
break
end
end
end
The results show for each number of boys chosen out of the 12:
boys ways
10 30240 5748019200
11 1663200 57480192000
12 59875200 172440576000
That total is 235,668,787,200 if the ways include the cases of fewer than 12 boys. For only the case in which all 12 boys are included, it's 172,440,576,000.
Going over Larry's original post, I note one mistake:
Method "4in1gap" there are 4 boys in one gap, 2 in the others:
Combination(5,1) = 5 ways
Method "3in2gap" there are 3 boys in two gaps, 2 in the others:
Combination(5,2) = 10 ways
and then multiplying the 5 times the 10. They are mutually exclusive events, not independent ones, and are to be added.
What's wanted is 24 * (5 + 10) * 12! = 172440576000, in agreement with my new calculation.
|
Posted by Charlie
on 2023-10-02 21:53:33 |