100 people standing in a circle in an order 1 to 100. No. 1 has a sword. He kills the next person (i.e. No. 2) and gives the sword to the next (i.e. No. 3). All people do the same until only 1 survives. Which number survives at the last? There are 100 people starting from 1 to 100.
can anyone please tell me how can i do it?
Discussion posts and replies are publicly visible
It's called the Josephus Problem. It was inspired by a story in "The Jewish War" by Flavius Josephus.
Apparently, the solutions for n=2 up to group size 78 are sequence number A006257 in the On-line Encyclopedia of Integer Sequences
Wikipedia
The Jewish War