Caroline correctly evaluates the expression |(x - y)(y - z)(z - x)| by replacing each of the variables x, y, z with a positive integer. How many possible answers between 1 and 100 (inclusive) could she have gotten?
had=[];
for x=1:1000
for y=1:1000
xmy=x-y;
for z=1:1000
v=abs(xmy*(x-z)*(y-z));
if v<101
had(end+1)=v;
end
end
end
end
had=unique(had);
length(had)
fprintf('%3d,',had)
fprintf('\n')
fprintf('%3d,',setdiff(1:100,had))
fprintf('\n')
finds there are 16 possible values:
0, 2, 6, 12, 16, 20, 30, 42, 48, 54, 56, 70, 72, 84, 90, 96
or rather 15, as zero was excluded in the actual problem.
Left out were:
1, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 97, 98, 99,100
|
Posted by Charlie
on 2025-03-27 09:13:26 |