Problem 44797. Cannibal eating odd and even numbered men
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 Solvers28
Suggested Problems
-
Find the sum of all the numbers of the input vector
47694 Solvers
-
Check to see if a Sudoku Puzzle is Solved
320 Solvers
-
403 Solvers
-
Write a function man that takes a row vector v and returns a matrix H as follows..
608 Solvers
-
Cube root of max value in a vector
82 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!