problem: Suppose there are 32 people standing in a circle. Person no.1 has a sword and he uses to kill no.2 and passes it onto person no.3. All the persons do the same until only 1 survives. A. Which number person will survive at last? B. What is your answer if there are 64 people? C. What is your answer if there are 100 people? D. What is your answer if there is 'n' number of people?
Answers
Step-by-step explanation:
Hlo how r u have a great day
Answer:
The person who survives in the given problem are as follows:
(A) Person no. 1 will survive.
(B) Person no. 1 will survive.
(C) Person no. 32 will survive.
(D) Person no. will survive.
Step-by-step explanation:
The given problem is an example of a Josephus puzzle, which is a recursive puzzle for calculating the survivor's number.
According to this, if there are n people in the circle, we subtract the highest power of 2 from it and then reduce it to some integer, k. for calculating the survivor, the expression is:
Number of person who survives: 2k+1
For (A), n = 32
Now, for a total of 32 people standing in the circle, representing n in the form of , we get:
So, we get k = 0, Thus, the survivor number will be:
Thus, the person no. 1 will be the one to survive when there are 32 people.
For (B), n = 64
Now, for a total of 64 people standing in the circle, representing n in the form of , we get:
So, we get k = 0, Thus, the survivor number will be:
Thus, the person no. 1 will be the one to survive when there are 64 people.
For (C), n = 100
Now, for a total of 100 people standing in the circle, representing n in the form of , we get:
So, we get k = 36, Thus, the survivor number will be:
Thus, the person no. 73 will be the one to survive when there are 100 people.
For (D), n = n
Now, for a total of n people standing in the circle, representing n in the form of , we get:
So, we get , Thus, the survivor number will be:
where is the highest power of 2 upto the integer n.