Showing posts with label Puzzles. Show all posts
Showing posts with label Puzzles. Show all posts

Thursday, April 12, 2012

Missing Keys in the Pocket

I have recently encountered an interesting problem online, which requires knowledge of conditional probability to solve.

You leave your apartment groggily one morning, closing the door behind you. Suddenly, you are hit by a terrifying question: Do you have your keys, or are you now locked out?

You stand there thinking about it for a few seconds, before deciding that yes, you probably have your keys, further estimating that 80% of the time, you have them. You also decide that there is an equal chance of your keys either being in your left pocket or your right pocket, and if they aren’t in either pocket then you don’t have them at all.

Slowly, perversely enjoying the sweat, you slide your hand into your right pocket, and find that your keys are not there. What should you now think is the probability that your keys are in your left pocket? 

The answer:
Two-thirds. To solve this without (much) explicit calculation, imagine all the scenarios where your right pocket is empty. 60% of the time, your right pocket will be empty (20% of the time because you forgot the keys, and 40% of the time where you remembered the keys but they were in the left pocket). The given information puts you in this 60%. Of this 60%, 2/3 of the time you actually have the keys. 

Of course, the above could be expressed more elegantly in equations.

Wednesday, January 05, 2011

Riddles about Pants and Shorts

One day I met four men, only one of whom was wearing purple pants. Each of them made one statement, then left.

A: At least two of us are lying.
B: The purple pants person is lying.
C: Everyone here is lying.
D: Only one of the other people is lying.

Who is wearing the purple pants?


On another day, I met another three people, only one of whom was wearing scarlet shorts. They made one statement each, and then left.

A) B wears the scarlet shorts!
B) A wears the scarlet shorts!
C) If B is lying, so am I. If B is telling the truth, so am I.

Who wears the scarlet shorts?

Thursday, December 23, 2010

Problems with Friends

A is a friend of B if and only if B is a friend of A.

Problem 1:
There are N people in the world, N > 1. Is it possible for everyone to have a unique number of friends?


A person is popular if none of his friends have more friends than him.
A person is a loner if none of his friends have less friends than him.

Problem 2:
In general, are there more loners or popular people?

Saturday, October 16, 2010

Page Flipping in the Lecture Halls

One lecturer likes to provide lecture notes consisting of many slides. As it is costly to print out that many number of pages, most students fit multiple slides onto a single page to reduce the number of pages needed.

A useful consequence of fitting multiple slides on one page is that one only needs to flip the page every X slides, where X is the number of slides on one page. This itself leads to the interesting phenomenon of there being a loud series of page flipping sounds every X slides, since most students need to flip the page to get to the next slide.

One day, I fell asleep during the lecture. I was awoken by the sound of page flipping. Apparently, the lecturer had just advanced past a slide. No worries, time to pay attention. The lecturer continued to teach, and slowly finished two more slides. Another loud series of page flipping sounds echoed through the lecture hall. Then he taught another slide, and when he was done many students began flipping their pages as well.

Glancing about myself, I suddenly realized that students tended to fit 4, 6, and 9 pages onto a slide. And, knowing that the lecturer had not taught past slide 50, I was able to deduce which slide the lecturer was on when I woke up.

Tuesday, September 08, 2009

Blood and Bags

A medical helicopter has a special compartment for carrying blood bags; in particular, the compartment can carry 4 blood bags of any capacity.

Now, the maximum amount of blood needed for any heli-rescue mission is 4.95 units; any more and the patient is already beyond the capabilities of the medical crew. Considering this, it is wise for the helicopter to carry not more than 4.95 units of blood.

Another problem faced is blood wastage. Since blood transfusions involve connecting the blood bag to the patient, the blood in each used bag is 'contaminated' and cannot be reused for other transfusions. Hence, using a 4.95 unit bag for an patient that requires only 0.50 units of blood is discouraged, since 4.45 units of blood are not used and wasted. However, unopened bags can be reused for subsequent missions and are hence not wasted.

Considering the above, it is desired to choose some capacity for each of the 4 blood bags such that the amount of blood wastage in the worst case is minimized. It is assumed that the flight doctor is capable of accurately determining the exact amount of blood needed for transfusion before the transfusion takes place.

What are the capacities of the 4 blood bags?

Thursday, August 20, 2009

Prisoners and Boxes

In a certain despotic nation, there are many prisoners being jailed. To alleviate the problem, the Emperor has decreed for all the prisoners to be "removed". What is decreed must be done; however the person doing the actual work is the High Jailer.

The Jailer thinks that the cost of bullets to execute everyone is too high, so he offers the prisoners the chance to earn their freedom. He proposes a game. There are X boxes in a room, with each box having the name of one unique prisoner. Since there are X prisoners, each prisoner's name is found in one and only one box.

The game is as follows: Each prisoner will be allowed to enter the room one at a time. The prisoner can then open all but one of the boxes; however, if the unopened box contains his name, everyone will be executed. If he does find his name in the opened boxes, he must restore the room to its original condition and leave the room. The prisoner will not be allowed to communicate to any prisoners that have yet to enter the room. If after all the prisoners have visited the room and found their names, they will all be released.

Needless to say, the boxes are arranged randomly. Still, each prisoner has a fairly good chance of finding his name; there is only a 1 / X chance of failing outright.

One of the prisoners, who is an amateur mathematician, remarks that the chance of everyone surviving is ( (X - 1) / X ) ^ X . He notes that by applying limits and using l'Hôpital's rule, the chance of surviving will increase with X, reaching e^-1 (0.368) when there are infinity prisoners. Not too bad a chance, he thinks.

At this point of time, another prisoner, an expert mathematician, speaks up and claims to have a better strategy! He shouts, "Why, with my plan, it is almost certain that we'll all survive!"

What is the mathematician's plan, and what is the chance of survival?


Note: This problem was derived from The condemned prisoners and the boxes, but the solution for our problem is more easily obtained.

Sunday, May 10, 2009

Children and Daughters

Here are two interesting problems for you.

Problem 1:

I have 100 children. The oldest 99 are girls. What is the chance that I have 100 daughters?

Show Answer
The answer is 1/2. Quite obvious, really.

Simple, no? Now for the next problem.

Problem 2:

I have 100 children. At least 99 of them are girls. What is the chance that I have 100 daughters?

Show Hint 1
No, the answer is not 1/2. Try again.
Show Hint 2
Use conditional probability to solve the problem.
Show Answer
The answer is 1/101. Compute this by finding P(A|B), where event A is having 100 daughters, and event B is having at least 99 daughters.

A fun problem, though I didn't really get it right instantly too.

Tuesday, September 09, 2008

Puzzle: Black and White

I found some old material on my old blog which I felt was sufficiently forgotten to be novel.

I created the puzzle a few years back, so I actually forgot how to solve it, but thankfully my brain still works, and so I was capable of re-solving it.

Hope this gives your brain some work.

Sunday, May 25, 2008

Battleship Solitaire

Recently, I've been playing a type of puzzle called Battleship Solitaire. Basically, this type of puzzle involves a battleship grid, and numbers along the sides of the grid. Based on these numbers, you are supposed to work out the locations of the ships.

In principle, the game works out to be similar in some areas as Paint By Numbers, and hence some strategies which I discovered earlier were viable for this game too. However, this game is probably (at my present skill level) partially dependent on luck, since some puzzles I played were ill-posed, having 2 possible solutions. Of course, this is almost certainly due to the puzzle generator, which does not check for the uniqueness of the solution.

Some sample shots of a new game and a solved puzzle follow.

A puzzle with 9 starting hints.

A solved puzzle.

The rules of the game (copied from this website), for reference, are :

The computer hides the ships in the grid and a few 'shots' will be fired into the grid to get you started (Hints). The ships will be hidden in the grid with the following rules.
  • The ships will be orientated in either the horizontal or vertical direction only.
  • No two ships will be adjacent in any direction including diagonally
  • There is one battleship (4 squares in length)
  • There are three cruisers (3 squares in length)
  • There are three destroyers (2 squares in length)
  • There are four subs (1 square only)
  • The numbers in the right column indicates the number of grid squares occupied by ships in the horizontal direction for each row.
  • The numbers in the bottom row indicate the number of grid squares occupied by ships in the vertical direction for each column.

Friday, February 15, 2008

Cursor*10

I found a game with a very unique and interesting gameplay, one which was so fresh that I had never seen before. I was so impressed by the game that I had to introduce it here.
I can't reveal much about the game without spoiling it. All that I can say is that the game requires you to "Cooperate by oneself ?!".

By the way, my (unimpressive) high score is 139. It is probably easy to beat this, but I don't want to click madly again.

Hope everyone enjoys this short game.

Wednesday, February 06, 2008

Test your Induction

The following sequence of three characters obeys a certain secret rule.

2, 4, 6

Your task is to infer the secret rule. To help you to discover the secret rule, you can produce any number of three character sequences for testing. I will then reply whether the produced sequence(s) obey the secret rule. (Pls try to propose sequences only in the tagboard; I will update the tested sequences in this post.)

As you can propose any number of character sequences for testing, you should only attempt to report the secret rule when you are absolutely sure that you have the correct rule in mind. To keep the game suspenseful, post rules only in the comments.

Sunday, December 09, 2007

Kill the Penguins !

Penguins led by the evil Guin Nep have invaded an iceberg ! There are so many penguins on the iceberg that every inch of the iceberg is covered with penguins.

You have to stop the infestation of penguins! You have 5 rockets, which can be used to bombard the iceberg. The rockets are all identical, and can hit any area of the iceberg. Each rocket will explode and kill all penguins within a radius Z of its landing spot. The yield of the rockets can be adjusted, hence, Z can be set to any value you desire. However, all the rockets must be set to the same yield, otherwise the launching platform will malfunction.

Your task is to choose 5 spots to target the five rockets at. Also, you must choose the minimum yield needed to kill all the penguins. In other words, choose 5 spots and the smallest Z such that the each spot of the iceberg is covered.

The final piece of information needed before you can save the iceberg from the penguins is that the iceberg happens to be in the shape of a perfect circle of radius R.

Alien Invaders

The great conqueror of worlds, Cyotr IV, was planning for the invasion of yet another planet. His advisor, the evil Guin Nep, stood beside him.

The great conqueror asked, "How many troops do I have available for this invasion ?"

Guin Nep checked some statistics, then replied, "Oh great one, you have a hundred thousand galaxy clusters under your control. In each galaxy cluster, there are a billion billion galaxies. In each galaxy, there are a billion billion stars clusters. In each star cluster, there are a billion billion stars. For each star, there are a billion billion divisions stationed there.

Finally, there are a billion troops per division. These figures work out to 10^86 troops. The figures are exact."

The conqueror paused for a moment, contemplating the great vastness of his forces.

"Split ALL my forces into 13 even fleets ! Prepare for the invasion of the universe !!!"

"13 even fleets, sir ? We won't be able to split the troops evenly; there'll be some troops left over. I would advise dividing the forces into 10 fl..."

"DIVIDE THE TROOPS INTO 13 EVEN FLEETS ! SACRIFICE THE LEFTOVER TROOPS !!!"


How many troops would be sacrificed ?

The Cursed Pirate Gold

Once, there were 7 pirates. The pirates had just robbed a small fishing boat and were now splitting the loot.

The loot was a small chest of less than 500 gold coins. The 7 pirates decided to split the loot evenly between themselves, as they were petty and did not want any one member to get more loot.

After a while, the gold coins were split into 7 stacks. However, the 7th stack had 1 coin less than the others. An argument broke out over who was to receive this 7th stack, and during the heated debate, one pirate was "accidentally" killed.

While the loss of manpower was regretable, the pirates consoled themselves with their now larger shares of the loot. Again, they pooled the coins and split it evenly among themselves. After some splitting, the coins were split into 6 stacks. Alas, the 6th stack was again 1 coin short!

A new scuffle broke out and another pirate was killed. The remaining 5 pirates split the coins into 5 stacks. Cursedly, they were 1 coin short again of having even stacks! One of the pirates, shocked at this unnatural occurence, shouted "A Ghost ! It be the work of ghosts !", then flipped over and died.

While the remaining 4 pirates were unnerved, greed was a stronger motivator. They split the gold into 4 stacks, but again, they were short by 1 coin !!! The burliest member of the band of brigands, a person of vulgar courage, slammed his fist on the table and shouted "I fear no work of demons ! Give me my gold !". He was swiftly killed by a falling lamp which was dislodged by his slamming action.

3 pirates were left, and they were clearly spooked. Yet, they divided the loot into 3 portions. One member, on seeing that one stack was again short of 1 coin, feared for his life and ran, leaving his share untouched !

The 2 remaining pirates decided to make the best of things and split the loot again, this time evenly among themselves. But the stacks were again uneven!

By now, the 2 pirates were spooked and decided to flee for their lives !


How many gold coins were there originally ?

Friday, August 17, 2007

Unfair Coin and Die Challenge

[Challenge #1]

Imagine that you have a biased two-sided coin. However, while you know that the coin is biased, you are unsure as to how the coin is biased; that is, you do not know the probability of getting a head or tail.

The first challenge is to use the coin to make a binary decision that has a 50% probabilty. In other words, find a way to make a fair decision.


[Challenge #2]

Imagine that you have a biased 6 six-sided die. As before, you have no idea how the die is biased.

The second challenge is to think of a method to somehow transform (via mathematical, non-physical-manipulation methods) the die into a fair die.

[Hints]
It may be neccessary to flip the coin more than once. Same goes for the die.

[Super Hints]
"May be" ==> "is".

Wednesday, July 18, 2007

Revolver Cylinder Puzzle

Yet another interesting puzzle :
Someone has kidnapped you and forced you to play a game of Russian Roulette ! Your kidnapper loads two bullets into adjacent chambers of an otherwise empty cylinder, and then spins the cylinder.

Then he presses the trigger ! Click ! Thankfully, the chamber was empty (this time!).

He then offers you a gamble : If you can survive the next round, he would set you free. To make it even better for you, he gives you two choices : One, he would spin the cylinder (randomly) before firing ; Two, he would just press the trigger now, without spinning.

Assuming that you would want to live through this encounter, what choice would you take? To spin or not to spin ?

Credits : Picture from howstuffworks , question from here.

Tuesday, July 17, 2007

Crazy Passenger Puzzle

Here's an interesting puzzle which I just encountered:
The Crazy Passenger

There are 100 airline passengers lining up to board the plane. They each hold a ticket to one of the 100 seats on that flight.

Unfortunately, the first person in line is crazy, and will ignore the seat number on his ticket, picking a random seat to occupy. All of the other passengers are quite normal, and will go to their proper seat unless it is already occupied. If it is occupied, they will then find a free seat to sit in, at random.

What is the probability that the last (100th) person to board the plane will sit in his proper seat?"

I found the puzzle (along with others) here. Unfortunately, I saw the numerical answer before giving the question much thought, but in my defense I did work out the solution almost immediately after.

Monday, September 04, 2006

100th Post

deMo sCoreThis is the 100th post. That is all.

No there is actually a secret message !!! Hehe.


Technorati Tags : ,

Sunday, June 04, 2006

Eye Puzzle

I created a new puzzle. This puzzle, which I call Eye Puzzle, requires the use of eye power and some patience. It's actually modelled after some old game I played on my computer.


Rules of the game :
1) Start from the red square and try to get to the blue square.
2) You may move to a neighbouring square (u,d,l,r) if it is coloured. Grey is a colour.
3) You may make any number of legal moves, or none at all.
4) If the square you are on happens to 'dissolve' into a white square, you have died ! Try again.

Hints :
1) The squares change colour about every 2 seconds.
2) The colours change from violet to green to yellow.
3) Grey squares are safe, they always remain grey.

**Warning : This game may damage your eyes.


Technorati Tags : , , ,