Archive for the 'Programming' Category

Josephus Permutation

The Josephus problem (or Josephus permutation) is a theoretical problem occurring in computer science and mathematics.

There are people standing in a circle waiting to be executed. After the first man is executed, certain number of people are skipped and one man is executed. Then again, people are skipped and a man is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last man remains, who is given freedom.

The task is to choose the place in the initial circle so that you survive (are the last one remaining).

for solution  – Go to this place!
for any confusions post Comments !