Last week I posted the Riddle of the Elves; today I shall *resolve* it. Pun (most definitely) intended.

The solution is perhaps more subtle than one might think — it has both a Diophantine equation to solve (one with non-unique solutions) followed by a logic problem. Based on the poem, there are five elves (Joy, Johnny, Jane, Sue, and Marcia), five costume colors (red, orange, yellow, green, and blue), and five toys (toy cars, sleds, trains, tops, and balls). It is reasonable to assume that each elf wears but one color and makes but one type of toy (although I have not investigated what might happen without this assumption). Moreover, each elf makes more than 2 toys, no two elves make the same number, and together they make 30 toys.

The first order of business is to figure how many toys are made by the different elves. This is equivalent to finding 5 distinct integers, each 3 or greater, such that (a) they sum to 30 and (b) one of them is 5. Assuming that the first four elves make as few toys as possible, we have 3 + 4 + 5 + 6 = 18, which means than the *maximum* number of toys any one elf can produce is 12.

However, we have additional constraints. Lines 13–14 show that one of the integers equals 3*g*, where *g* is the number of toys made by the green elf. Since we’ve already noted that 3*g* must be at most 12, we conclude that *g* must be 3 or 4.

Finally, lines 4–8 show that three of the numbers must be consecutive integers, say, *r*, *r*+1, and *r*+2, where *r* is the number of toys made by the red elf. Note these three numbers sum to less than 30, this means *r* is at most 8.

Let us examine the possibilities. Let’s assume first that *g* = 3, so that 3 and 9 are among the solution numbers, which accounts for a total of 12 of the 30 toys.

- The smallest allowable value for
*r*would be 4, which implies that {4,5,6} are the remaining solution numbers. This accounts for 15 additional toys, which does not sum to 30. This is not a valid solution. - If
*r*= 5, then {5,6,7} are the remaining solution numbers. This accounts for 18 additional toys, which sums to 30. Thus, {3,5,6,7,9} is a solution, with*g*= 3 and*r*= 5. - If
*r*= 6, then {6,7,8} are the remaining solution numbers. Since 5 is not among them, this is not a solution. - If
*r*= 7, then {7,8,9} are among the solutions. Since 9 is duplicated, 5 must be the remaining number, but then 3+5+7+8+9 = 32 toys are made, which is impossible. - If
*r*= 8, then {8,9,10} are among the solutions. Since 9 is duplicated, 5 must be the remaining number, but then 3+5+8+9+10= 35 toys are made, which is impossible.

Now, suppose *g* = 4, so that 4 and 12 are among the solution numbers, accounting for 16 of the 30 toys.

- If
*r*= 3, then {3,4,5} are among the solution numbers. Since 4 is duplicated, this accounts for a total of 3+4+5+12 = 24 toys, meaning 6 are left over. Thus, {3,4,5,6,12} is a solution, with*g*= 4 and*r =*3. - The next allowable choice is
*r*= 5, so {5,6,7} are the remaining solutions, but this accounts for an additional 18 toys, which does not sum to 30. - If
*r*= 6, 7, or 8, then 5 is not among the remaining solution numbers, yielding an invalid solution.

Hence, there are 2 *numerical* solutions to the toy-making problem:

- The solution {3,4,5,6,12} with
*g*= 4 and*r*= 3, and - The solution {3,5,6,7,9} with
*g*= 3 and*r*= 5.

Now let’s see if we can place names, colors, and toys with these numbers. If we consider solution 1, we can draw the following conclusions immediately from the lines of the poem (specifically, lines 5–8, 10, 13–14, and 17–18):

Number | 3 | 4 | 5 | 6 | 12 |

Name | Joy | Jane | Sue | ||

Color | red | green | |||

Toy | sled | tops |

Since the yellow elf made the trains, this must be the elf who made 6, since this is the the only one for which both color and toy are undetermined. This yields

Number | 3 | 4 | 5 | 6 | 12 |

Name | Joy | Jane | Sue | ||

Color | red | green | yellow | ||

Toy | sled | trains | tops |

Unfortunately for us, this implies that Marcia (one of the elves not yet determined) must wear either red or yellow; this contradicts the fact that she must wear orange in line 15. Hence, we can toss solution 1 out as invalid.

This leaves only solution 2. We can draw the following immediate conclusions directly from lines of the poem (listed above):

Number | 3 | 5 | 6 | 7 | 9 |

Name | Jane | Joy | Sue | ||

Color | green | red | |||

Toy | sled | tops |

Since Johnny made the cars, he must be the green elf, since this is the only one for which both name and toy are undetermined. Similarly, since the yellow elf made the trains, she must be Joy, since this is the the only one for which both color and toy are undetermined. Finally, since Marcia dressed in orange, she must make the sleds, since this is the only one for which both name and color are undetermined. Thus, we have

Number | 3 | 5 | 6 | 7 | 9 |

Name | Johnny | Jane | Joy | Marcia | Sue |

Color | green | red | yellow | orange | |

Toy | cars | trains | sled | tops |

Filling in the remaining entries, we have the solution

Number |
3 |
5 |
6 |
7 |
9 |

Name |
Johnny |
Jane |
Joy |
Marcia |
Sue |

Color |
green |
red |
yellow |
orange |
blue |

Toy |
cars |
balls |
trains |
sled |
tops |

And thanks to Ben and Adam for their contributions in the comments. And thanks to everyone who played on their own!