Monday, September 7, 2009

The Circle of death !

This is my 1st Mathematical blog and hence entirely technical one !

The Problem at hand was an old one :

Suppose 1000 men are standing in a circle ; with 1st man holding a gun !
1st man shoots the 2nd guy and gives the gun to 3rd who shoots the 4th
and gives gun to 5th ..........999th shoots 1000th and gives gun back to 1st
whi now kills the 3rd and gives gun to 5th ..... the cycle continues .
Who will be the last Survivor ?!


All varied approaches were tried but answer was reached by 2 ways only
1. Brute force of actually killing 999 people on paper to find the survivor
2.Writing computer program to find the solution

Both were done! 1st by me , 2nd by my friend Shalabh and answers matched 977th person would survive ! Shalabh's program went 1 step ahead , coz it was written for N no. of people !
i.e it accepted how many people did we want in circle of death and calculated the last survivor in each case !

The program made me think and plot the list of survivors against no of people involved in the circle of death! and what followed was beauty of maths revealing itself !


Total no of ppl and No. of the Survivor

( n = m )
n = No of ppl in the circle ;
m = Position of the person who survied the shoot out !

1 = 1st

2 = 1st
3 = 3rd

4 = 1st
5 = 3rd
6 = 5th
7 = 7th

8 = 1st
9 = 3rd
10 = 5th
11 = 7th
12 = 9th
13 = 11th
14 = 13th
15 = 15th

16 = 1st
17 = 3rd
18 = 5th
19 = 7th
20 = 9th
21 = 11th
22 = 13th
23 = 15th
24 = 17th
25 = 19th
26 = 21st
27 = 23 rd
28 = 25 th
29 = 27th
30 = 29th
31 = 31th



The series of odd numbered survivors repeats itself each time growing in a specific way !


1 => 1st cycle 1 = 2^0 element Total =1


1 3 => 2nd cycle 2 = 2^1 elements Total =1+2= 3


1 3 5 7 => 3rd cycle 4 = 2^2 elements Total =1+2+4=7


1 3 5 7 9 11 13 15 => 4th cycle 8 = 2^3 elements Total=1+2+4+8=15


1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 => 5th cycle 16= 2^4 element Total=1+2+4+8+16=31 .
.
.
.


The elements in each cycle grow as the power of 2 !

So now according to problem under consideration
n = 1000 ;
Aftr completing 9 cycles of growing odd series
i.e 1+2+4+8+16+31+64+128+256 = 511 elements are done

now cycle having 2^10=512 elements begins ;
n = 1000 corresponds to 1000-511 = 489 th odd no in cycle containing 2^9 elements

(
1000 = 2^0 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 + 2^6 + 2^7 + 2^8 + 489
= 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 489
)

Thus the person having 489th odd no. will survive the shootout of 1000 people !
i.e. (2*489 - 1 ) = 489th odd no. = 977th person will Survive!


Now using above concept, survivor in case of N no. of people in circle of death can be solved
with ease !
 
Watch the latest videos on YouTube.com