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.
(In reply to
computer solution by Charlie)
Addendum: since the text does use the word 'set', Charlie is correct that duplicate entries for n and m should be counted only once.
Added code to recalculate and instead of 20 pairs and 40 integers, there are only 36 unique integers, and their mean is 2372/9 or 263.5555...
----------
newlist = []
for pair in nmlist:
newlist.append(pair[0])
newlist.append(pair[1])
newlist = list(set(newlist))
print(sum(newlist) / len(newlist))
|
Posted by Larry
on 2025-04-14 09:59:50 |