After having difficulty finding a solution where the calculation of averages took into consideration ages by month, I thought maybe ages were calculated as of the last birthday, and that the 18-month difference in averages was really a 1.5-year difference in averages of integral years.
I assumed that in the "group of n people" n was the number of people last month so that n+2 is the number this month.
DEFDBL A-Z
FOR srm = 2 TO 11
m = srm * srm
FOR srn = 2 TO 11
n = srn * srn
lastmo = n * 37
FOR bd = 0 TO n
thismo = lastmo + bd + 38 + 33 + 40 - m
'IF thismo / (n + 2) = lastmo / (n) - 1.5 THEN PRINT m, n
IF thismo * (n) = lastmo * (n + 2) - 1.5 * n * (n + 2) THEN PRINT m; "years", n; "people", bd; "birthdays"
NEXT bd
NEXT
NEXT
finds
49 years 4 people 3 birthdays
64 years 16 people 0 birthdays
100 years 36 people 6 birthdays
121 years 36 people 27 birthdays
for m, n and the number of birthdays taking place in the intervening month.
For example, with 4 people originally the total ages were 4*37=148; when 33+38+40-49 are added in, the total becomes 210, but with 3 birthdays having passed, it's 213. With the group now at 6, the average age is 35.5, or 18 months younger.
If you want a solution with no birthdays having passed, m would be 64 and n = 16.
|
Posted by Charlie
on 2013-04-29 14:41:50 |