There are n sticks which have distinct integer length. Suppose that it's possible to form a non-degenerate triangle from any 3 distinct sticks among them. It's also known that there are sticks of lengths 5 and 12 among them. What is the largest possible value of n under such conditions?
clearvars,clc
ptr=1; v=3;
while v<131072
set=dec2base(v,2,17);
psns=strfind(set,'1');
if ismember(5,psns) && ismember(12,psns) && length(psns)>2
good=true;
cmb=combinator(length(psns),3,'c');
cmb=psns(cmb);
for i=1:size(cmb,1)
t=sum(cmb(i,:));
if 2*max(cmb(i,:))>=t
good=false;
break;
end
end
if good
disp(psns)
end
end
v=v+1;
end
finds the possible sets of sticks of varied lengths, the largest of which has 6 sticks:
5 12 16
5 12 15
5 12 15 16
5 12 14
5 12 14 16
5 12 14 15
5 12 14 15 16
5 12 13
5 12 13 16
5 12 13 15
5 12 13 15 16
5 12 13 14
5 12 13 14 16
5 12 13 14 15
5 12 13 14 15 16
5 11 12
5 11 12 15
5 11 12 14
5 11 12 14 15
5 11 12 13
5 11 12 13 15
5 11 12 13 14
5 11 12 13 14 15
5 10 12
5 10 12 14
5 10 12 13
5 10 12 13 14
5 10 11 12
5 10 11 12 14
5 10 11 12 13
5 10 11 12 13 14
5 9 12
5 9 12 13
5 9 11 12
5 9 11 12 13
5 9 10 12
5 9 10 12 13
5 9 10 11 12
5 9 10 11 12 13
5 8 12
5 8 11 12
5 8 10 12
5 8 10 11 12
5 8 9 12
5 8 9 11 12
5 8 9 10 12
5 8 9 10 11 12
It became apparent that the number sets merely needed to have the highest number be larger than the sum of the two lowest, at the level of the full set, rather than checking individual triples within the set. ... also that increasing the size of the second smallest stick then raised both the highest and lowest lengths of the remaining portion of the set.
|
Posted by Charlie
on 2023-07-11 09:28:31 |