alimsahy / The-Josephus

Josephus math problem solver written in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Josephus

This math problem based on something from history.

There was group of Jewish soldiers who were surrounded by the Roman army and they didn't want to get captured, so they decided to come up with a system to avoid getting captured or suicide. So they'd sit in a circle, and the first man would kill the guy to the left of him. The next remaining living person would kill the next remaining living person with their sword. They'd go around like this, till there's only one person left. And the last person would have to suicide, rather than captured.

In the story, Josephus preferred captured than suicide but he worried that if he said this, the other soldiers would turn on him. So he wanted to figure out. Where should he sit within the circle in order to be the last man living and then he would surrender, rather than kill him self. That was the problem.

This program calculates where Josephus should be sit in the circle

Sources

About

Josephus math problem solver written in C++


Languages

Language:C++ 100.0%