Thursday, August 11, 2011

6 Bullet & a Pesron Puzzle

You have been taken hostage by terrorists. Terrorist has a revolver with 6 empty chambers. He now loads the revolver with 2 bullets in front of you. These two bullets are kept next to each other (contiguously) in the 2 adjacent chambers, the terrorist now spins the barrel so that now you don't know what is location of bullets in chamber. He keep the revolver against your head and pulls the trigger. But its lucky day for you. It was the empty chamber. Now terrorist gives a slight chance to get free. He gives you a choice whether he should spin the barrel first then pull the trigger again.. or should just simply pull the trigger again ? If you get lucky again, terrorists will let you go..otherwise ..!!!


So what would you prefer ? Would you want him to spin the barrel first then shoot or just shoot without spinning the barrel ?

Minimum number of cuts to the bar of gold that will allow you to pay to worker 1/7th each day ?

A worker is to perform work for you for seven straight days. In return for his work, you will pay him 1/7th of a bar of gold per day. The worker requires a daily payment of 1/7th of the bar of gold. What and where are the fewest number of cuts to the bar of gold that will allow you to pay him 1/7th each day?

Solution
Gold bar need minimum two cuts. It should be divided in powers of two.
e.g. for i=0 to k where 2^k is nearly equals to N length of gold piece. 1 ,2 , 4........assuming 7 parts which is divided into a total of 1,2,4.

first day : 1 ---(1)
second day: take back one and give 2----(2)
third day : give back one----(1,2)
fourth day : take back 2,1 and give 4 ----(4)
fifth day : give back 1------(1,4)
sixth day : give 2 and take back 1-----(4,2)
sevent day : give back one-------(1,2,4)

Tuesday, August 9, 2011

What is the probability that you toss next time, heads turns up.

A bag contains 5 coins. Four of them are fair and one has heads on
both sides. You randomly pulled one coin from the bag and tossed it 5
times, heads turned up all five times. What is the probability that
you toss next time, heads turns up. (All this time you don't know you
were tossing a fair coin or not).


The probability of getting n consecutive heads is
P(n heads) = 1/5 * 1 + 4/5 * (1/2)^n,
Thus, the probability of getting a head on the n+1st roll given that
you have gotten heads on all n previous rolls is
P(n+1 heads | n heads) = P(n+1) / P(n)
= ( 1/5 * 1 + 4/5 * (1/2)^(n+1) ) / ( 1/5 * 1 + 4/5 * (1/2)^n ).
Multiplying numerator and denominator by 5* 2^(n-1) and recognizing 4
as 2^2 gives
P(n+1 heads | n heads) = (2^(n-1) + 1) / (2^(n-1) + 2)

put n=5 in above expression probability that you toss next time, heads turns up will be 17/18