There are N men in a queue. A cannibal eats either all odd-numbered or all even-numbered men in the queue at a time. In the first round he eats all the odd-numbered. In the next round he eats all even-numbered. This goes on repeating (with odd or even toggling after every round) till there is only 1 man in the queue. What would be the original number of this man in the queue? e.g. If N = 6,
Men remaining after round 1: 2, 4, 6
Men remaining after round 2: 2, 6
Men remaining after round 3: 6
Hence answer = 6
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers33
Suggested Problems
-
Project Euler: Problem 3, Largest prime factor
1816 Solvers
-
Sum of diagonal of a square matrix
1642 Solvers
-
Output any real number that is neither positive nor negative
411 Solvers
-
Side of an equilateral triangle
7081 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2211 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!