The Mathematica Journal
Departments
Download This Issue
Home
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
Columns
The Mathematica Programmer
New Products
New Publications
Classifieds
Calendar
News Bulletins
Editor's Pick
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues

Puzzle 3

The Problem

I copied this text from achalfin@netmagic.net. It was discussed in the newsgroup comp.soft.sys.mathematica in December 1997.

From the following set of 16 facts, first try to determine who drinks water.  Then, decide who owns the zebra.

1. There are five houses.
2. The Englishman lives in the red house.
3. The Spaniard owns a dog.
4. Coffee is drunk in the green house.
5. The Ukrainian drinks tea.
6. The green house is immediately to the right of the ivory house.
7. The Old Gold smoker owns snails.
8. Kools are smoked in the yellow house.
9. Milk is drunk in the middle house.
10. The Norwegian lives in the first house.
11. The Chesterfield smoker lives next door to the man with the fox.
12. Kools are smoked in the house next to the house with a horse.
13. The Lucky Strike smoker drinks orange juice.
14. The Japanese smokes Parliaments.
15. The Norwegian lives next door to the blue house.
16. In each house there is one nationality, one pet, one brand of cigarette smoked, and one kind of liquid drunk.

The Solution

To each house we can associate a list of the form {houseNumber, houseColor, nation, drink, smoke, pet}. There are [Graphics:../Images/index_gr_105.gif] possibilities to associate house number, house color, nationality, drinking preference, smoking habits, and pet choice. We will gradually build up all compatible lists so that, at each stage, we will have to deal with a smaller number of choices. These are the possible house numbers, house colors, nationalities, drinks, smokes, and pets.

[Graphics:../Images/index_gr_106.gif]

Let's start with the house numbers and colors.

[Graphics:../Images/index_gr_107.gif]

At this point, we have 120 different choices.

[Graphics:../Images/index_gr_108.gif]
[Graphics:../Images/index_gr_109.gif]

By making use of condition 6, "The green house is immediately to the right of the ivory house," we can reduce the above list to 24 choices.

[Graphics:../Images/index_gr_110.gif]
[Graphics:../Images/index_gr_111.gif]
[Graphics:../Images/index_gr_112.gif]
[Graphics:../Images/index_gr_113.gif]

Now we add the possible nationalities, yielding 2,880 possible choices.

[Graphics:../Images/index_gr_114.gif]
[Graphics:../Images/index_gr_115.gif]

By making use of conditions 2, 10, and 15, we can reduce the above list to 12 choices.

[Graphics:../Images/index_gr_116.gif]
[Graphics:../Images/index_gr_117.gif]

Now we add the possible drink choices, yielding 1,440 possible choices.

[Graphics:../Images/index_gr_118.gif]
[Graphics:../Images/index_gr_119.gif]

Making use of conditions 4, 5, and 9, we can again reduce the above list to just 12 choices.

[Graphics:../Images/index_gr_120.gif]
[Graphics:../Images/index_gr_121.gif]

Now we add the possible smoking choices.

[Graphics:../Images/index_gr_122.gif]
[Graphics:../Images/index_gr_123.gif]

Using conditions 8, 13, and 14, we can reduce the above list to only eight choices.

[Graphics:../Images/index_gr_124.gif]
[Graphics:../Images/index_gr_125.gif]

Finally, we add the possible pets, which yields a total of 960 possible choices.

[Graphics:../Images/index_gr_126.gif]
[Graphics:../Images/index_gr_127.gif]

Using conditions 3, 7, 11, and 12, we get the unique final result.

[Graphics:../Images/index_gr_128.gif]
[Graphics:../Images/index_gr_129.gif]
[Graphics:../Images/index_gr_130.gif]
1
yellow
norwegian
water
kools
fox
2
blue
ukraninian
tea
chesterfield
horse
3
red
englishman
milk
oldGold
snails
4
ivory
spaniard
orangeJuice
luckyStrike
dog
5
green
japanese
coffee
parliaments
zebra

This means that, in this smoky and colorful neighborhood, the Norwegian drinks water and the Japanese owns the zebra.


Converted by Mathematica      October 5, 1999

[Prev Page]