Interview Prep

Josephus Problem Answer: Person 73 Survives [Solved]

Josephus problem answer: a circle of 100 people with one man holding a glowing sword

Answer: Person 73 survives. The Josephus problem answer is 73. With 100 people in a circle and every second person eliminated, the last person standing is number 73. The shortcut is the power of two: 100 minus 64 is 36, and 2 times 36 plus 1 is 73.

One hundred people stand in a circle, numbered 1 to 100. Person 1 holds a sword, removes person 2, and passes the sword to person 3. The pattern keeps going around the circle until one person is left. The question is simple: where should you stand to survive?

This is the Josephus problem, one of the oldest puzzles in mathematics, and it still shows up in technical interviews. Coding interview collections such as InterviewBit list it as a standard recursion question, and the 100-person version tests whether a candidate can spot a pattern instead of counting to 100 by hand. The name comes from Flavius Josephus, a first-century historian who, by his own account in The Jewish War, drew lots with forty soldiers during the siege of Yodfat in 67 CE so that they would kill each other rather than surrender. Josephus arranged the order so that he was among the last two alive.

The Puzzle: 100 People in a Circle

Here is the puzzle exactly as an interviewer would set it:

One hundred people stand in a circle, numbered 1 to 100. Person 1 has a sword. He removes person 2 and passes the sword to person 3. Person 3 removes person 4 and passes the sword to person 5. This continues around the circle until only one person remains. Which number survives?

The rules are fixed: the sword always moves to the next living person, and the holder always removes the next living person after them. Nobody changes places, and nobody gets a second chance.

The Josephus Problem Answer, Step by Step

Counting through all 100 people by hand takes seven passes, and it is easy to lose track. The fast route is to look at small circles first and find the pattern.

Step 1: Try small circles and spot the pattern

Work out the survivor for a few small circles, with the same rule, every second person out:

People in the circleSurvivor
21
33
41
53
65
77
81
93
105
161
321
641

Look at the rows where the survivor is 1: circles of 2, 4, 8, 16, 32 and 64 people. Those are all powers of two. When the circle holds a power of two, every full pass removes exactly half the people, the sword comes back to person 1, and person 1 is still holding it when the last person falls.

Step 2: Shrink 100 down to a power of two

One hundred is not a power of two, but 64 is the largest power of two below it, and the gap is 36. So the first 36 removals are just a countdown to a 64-person circle. They hit the even numbers in order, and the 36th person removed is number 72, taken out by person 71. The sword then passes to person 73.

At that moment, 64 people are still standing, and person 73 holds the sword, exactly the position person 1 holds in a fresh 64-person circle, where the starter always survives. So person 73 survives. The formula is simple: survivor equals 2 times the gap plus 1, and 2 times 36 plus 1 is 73.

Step 3: Check it against the full count

The slow way confirms the shortcut. Here is how many people are left after each pass around the circle:

After passPeople leftWho is still standing
150Odd numbers 1 to 99
2251, 5, 9, up to 97
3129, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97
469, 25, 41, 57, 73, 89
539, 41, 73
629, 73
7173

Notice the third pass: person 1 is removed there, taken out by person 97, which is why person 1 does not survive even though the sword started with them. In the final pass, person 73 removes person 9 and stands alone.

Why the Josephus Problem Answer Is 73

The power-of-two reasoning is the whole proof, and it works for any circle size. Take any number of people, find the largest power of two below it, and count the gap. The first gap-many removals reduce the circle to that power of two, and whoever holds the sword then becomes the new starter, who always wins. The general formula is: survivor equals 2 times the gap plus 1.

There is also a neat binary trick that gives the same answer in seconds. Write 100 in binary: 1100100. Move the leading 1 to the end of the number and you get 1001001, which is 73 in decimal. The trick works because removing the leading 1 subtracts the largest power of two, and doubling plus one is the same as shifting the binary digits left and adding a 1. It is a party trick, but it rests on the same reasoning as the proof above, so use it in an interview only after you can explain the power-of-two logic behind it.

Try the formula on a smaller case. With 50 people, the largest power of two below 50 is 32, the gap is 18, and 2 times 18 plus 1 is 37, so person 37 survives.

The Trap Most Candidates Fall Into

The most common wrong answer is person 1. It sounds reasonable: person 1 starts with the sword, so person 1 should win. But person 1 only wins when the circle holds a power of two. In a 100-person circle, person 1 is removed in the third pass, as the table above shows. The starting advantage is real but fragile, and it breaks as soon as the count is not a power of two.

The second trap is brute force. Candidates start crossing out numbers one by one and lose track around the third pass, usually by forgetting who holds the sword when a pass ends. If you do count it out, write down who holds the sword at the start of each pass. That single note keeps the whole count honest. But the stronger move is to stop counting early and look for the pattern, which is what the interviewer is waiting to see.

What the Interviewer Is Testing in the Josephus Problem Answer

This puzzle tests three things. First, it tests whether you generalise instead of grinding. Counting to 100 by hand shows patience, but trying 2, 4, 8 and 16 people and spotting the pattern shows thinking that scales. Second, it tests whether you can prove a pattern, not just notice it. Saying 73 is the answer earns a nod; explaining why the 64-person circle makes 73 the new starter earns the mark.

Third, it tests how you handle a problem that looks like pure arithmetic. The Josephus problem is really a recursion problem wearing a story, and interviewers want to see you reach for structure: powers of two, binary, and a formula that works for any circle size. Talk through the small cases out loud, because the interviewer is grading the reasoning, not the final number.

Try Another Puzzle Next

If you liked the Josephus problem, try the 100 Prisoners Boxes Puzzle, where the right strategy lifts the survival chance from near zero to 31%. Or take on the 25 Horses Puzzle, which finds the three fastest horses in just seven races. For a longer challenge, the Bridge and Torch Puzzle asks four people to cross in 17 minutes with one torch. All three reward the same habit: find the pattern before you start counting.

Frequently Asked Questions

What is the Josephus problem?

It is a counting-out puzzle named after the historian Flavius Josephus. People stand in a circle, every second person is removed, and the task is to find the last person standing. In the classic 100-person version, the survivor is number 73.

Why does person 73 survive and not person 1?

Person 1 only wins when the circle holds a power of two, such as 64. In a 100-person circle, the first 36 removals shrink the circle to 64 people, and person 73 holds the sword when that happens. From there, 73 plays the role of person 1, and the starter always wins.

Is there a formula for the Josephus problem?

Yes. For every second person removed, find the largest power of two below the number of people, subtract it to get the gap, and the survivor is 2 times the gap plus 1. For 100 people: 100 minus 64 is 36, and 2 times 36 plus 1 is 73.

Enjoying this? Add StudyFromNotes as a preferred source on Google to see our latest notes and updates more often:

Leave a Reply

Your email address will not be published. Required fields are marked *