Home » Articles, Exercises, & Examples » Logic

Category: Logic

Pythagorean Triples

Pythagorean triples are sets of three integers that are solutions to the associated identity for right triangles.

The question is this:

Can you find a formula or algorithm for generating Pythagorean Triples?

There may be more than one formula, and each might not be exhaustive. All we are after is a set of rules such that, given one number, can you find the other two that belong to the triplet?

pythagorean theorem

Blue Dot

There is an island with 100 women. 50 of the women have red dots on their foreheads, and the other 50 women have blue dots on their foreheads.

If a woman ever learns the color of the dot on her forehead, she must permanently leave the island in the middle of that night.

One day, an oracle appears and says “at least one woman has a blue dot on her forehead.” The woman all know that the oracle speaks the truth.

All the woman are perfect logicians (and know that the others are pefect logicians too). What happens next?


Related Problem:

Three Masters of Logic wanted to find out who was the wisest amongst them. So they turned to their Grand Master, asking to resolve their dispute. “Easy,” the old sage said. “I will blindfold you and paint either red, or blue dot on each man’s forehead. When I take your blindfolds off, if you see at least one red dot, raise your hand. The one, who guesses the color of the dot on his forehead first, wins.” And so it was said, and so it was done. The Grand Master blindfolded the three contestants and painted red dots on every one. When he took their blindfolds off, all three men raised their hands as the rules required, and sat in silence pondering. Finally, one of them said: “I have a red dot on my forehead.”

How did he guess?

Ten Envelopes

A man told his son that he would give him $1000 if he could accomplish the following task. The father gave his son ten envelopes and a thousand dollars, all in one dollar bills. He told his son, “Place the money in the envelopes in such a manner that no matter what number of dollars I ask for, you can give me one or more of the envelopes, containing the exact amount I asked for without having to open any of the envelopes. If you can do this, you will keep the $1000.” When the father asked for a sum of money, the son was able to give him envelopes containing the exact amount of money asked for. How did the son distribute the money among the ten envelopes?

envelope full of one dollar bills
Envelope Dollar E Mail Money Bill Gift Christmas

Pirates & Coins

The Game:

There are 5 rational pirates (in strict order of seniority A, B, C, D and E) who found 100 gold coins. They must decide how to distribute them.

The pirate world’s rules of distribution say that the most senior pirate first proposes a plan of distribution. The pirates, including the proposer, then vote on whether to accept this distribution. If the majority accepts the plan, the coins are dispersed and the game ends. In case of a tie vote, the proposer has the casting vote. If the majority rejects the plan, the proposer is thrown overboard from the pirate ship and dies, and the next most senior pirate makes a new proposal to begin the system again. The process repeats until a plan is accepted or if there is one pirate left.

Pirates base their decisions on four factors:

  1. First of all, each pirate wants to survive.
  2. Second, given survival, each pirate wants to maximize the number of gold coins he receives.
  3. Third, each pirate would prefer to throw another overboard, if all other results would otherwise be equal.
  4. And finally, the pirates do not trust each other, and will neither make nor honor any promises between pirates apart from a proposed distribution plan that gives a whole number of gold coins to each pirate.

Five Pirates, One Hundred Coins


Extension:  Keep everything above the same, except change it to 500 pirates rather than 5.   Can the same strategy be applied?


Prisoner Problem

During an ancient war three prisoners were brought into a room. In the room was a large box containing three white hats and two black hats. Each man was blindfolded, and one of the hats was placed on his head.

The men were lined up, one behind the other, facing the wall. The blindfold of the man farthest from the wall (man C) was removed, and he was permitted to look at the hats of the two men in front of him. If he knew (not guessed) the color of the hat on his head, he would be freed. However, he was unable to tell. The blindfold was then taken from the head of the next man (man B), who could see only the hat of the one man in front of him. This man had the same chance for freedom, but he, too, was unable to tell the color of his hat. The remaining man (man A) then told the guards the color of the hat he was wearing and was released. What color hat was he wearing, and how did he know?

three black hats and two white hats

Ask Marylin About Doors

Adapted from Parade magazine, April 15th, 1990:

There are 1,000 tenants and 1,000 apartments. The first tenant opens every door. The second closes every other door. The third tenant goes to every third door, closing it if it is open and opening it if it is closed. The fourth tenant goes to every third door, closing it if it is open and opening it if it is closed. This continues with every tenant until the 1,000th tenant opens the 1,000th door. Which doors are open?

1000 apartment doors


Bonus question: Can you be sure ahead of time that the 1,000th tenant closes the 1,000th door rather than opens it? How can you be sure?

Another problem from Parade (same column, same year) about doors:

Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Is it to your advantage to switch your choice?

three doors