Skip to content

A program to find the solution to the Josephus Problem

License

Notifications You must be signed in to change notification settings

sahasatvik/SwordPuzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SwordPuzzle

A program to find the solution of an interesting puzzle ...

The Puzzle

In this puzzle, we have N number of people standing in a circle. They are numbered (1 - N). Initially, the first person carries a sword. The 'sword carrier' kills the next person, then passes it to the next person standing. This continues until only 1 person is still alive.

Who is the last person standing?

How to use this program

Compile the Puzzle.java file to get a Puzzle.class file :

    javac Puzzle.java

(the .class file is available in the repository) ... and run it as follows :

    java Puzzle [number of people - 100 by default] [number of people to be left alive - 1 by default]

About

A program to find the solution to the Josephus Problem

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages