 Ben’s oldest son was a twin.
 All of Ben’s children were twins except for 41 of them.
 All of Ben’s children were triplets except for 41 of them.
 All of Ben’s children were quadruplets except for 41 of them.
How many children did Ben have?
*** Counting triplets as twins or, quadruplets as triplets is not permissible.
FOR sing = 0 TO 41
FOR twinsets = 0 TO 25
FOR tripsets = 0 TO 25
FOR quadsets = 0 TO 25
kids = 2 * twinsets + 3 * tripsets + 4 * quadsets + sing
nontwin = kids  twinsets * 2
nontrip = kids  tripsets * 3
nonquad = kids  quadsets * 4
IF nontwin = 41 AND nontrip = 41 AND nonquad = 41 THEN
PRINT sing; twinsets; tripsets; quadsets, kids
END IF
NEXT
NEXT
NEXT
NEXT
finds
17 6 4 3 53
41 0 0 0 41
for the number of single births, sets of twins, sets of triplets, sets of quadrupleds, and the consequent total number of children.
Statement 1 requires that there be at least one set of twins, to the top line is the solution: there are 53 children all together: 17 singletons, 6 pairs of twins, 4 sets of triplets and 3 sets of quadruplets.

Posted by Charlie
on 20130902 14:20:54 