There exists positive integers m and n such that 2/m + 3/n = 1/16. Find the mean of the set of integers which contains all possible values of m and n.
clearvars
list=[];
tot=sym(1/16);
for n=1:2000
m= sym(2/(1/16-3/n));
if m>0 && m==floor(m) && m<Inf
disp([m n])
list(end+1)=m;
list(end+1)=n;
end
end
length(list)
length(unique(list))
>> meansOfPairs
[1568, 49]
[800, 50]
[544, 51]
[416, 52]
[288, 54]
[224, 56]
[160, 60]
[128, 64]
[96, 72]
[80, 80]
[64, 96]
[56, 112]
[48, 144]
[44, 176]
[40, 240]
[38, 304]
[36, 432]
[35, 560]
[34, 816]
[33, 1584]
ans =
40
ans =
36
The pairs appear above. The two answers at the bottom are, first, the number of numbers appearing, that is, twice the number of pairs; and, second, the number of distinct numbers.
56, 64, 80, 96 are duplicated, so while 40 numbers appear recorded in the list, there are only 36 unique numbers.
>> mean(list)
ans =
244.6
>> mean(unique(list))
ans =
263.555555555556
so if the duplicated values are counted the two times each appears, the mean is 244.6; if they are counted only once, the mean is 263 + 5/9.
|
Posted by Charlie
on 2025-04-14 09:01:20 |