Skip to content

Latest commit

 

History

History
30 lines (17 loc) · 862 Bytes

README.md

File metadata and controls

30 lines (17 loc) · 862 Bytes

Josephus Problem

Description

n people numbered from 1 to n stand in a circle. 1 has a sword, kills 2, and passes the sword to 3, who kills 4 and passes the sword to 5, and so on. This is repeated until only one person remains. Which number ≤ n does the survivor have?

You can read more about this problem on Wikipedia.

Quick Start

julia> using JosephusProblem

julia> josephus_perm(100)
73

Calculation

We calculate the result using the bitwise formulae fi:

formulae

We can see a pattern that emerges which illustrates these formulae nicely:

formulae

Citation

If your research depends on JosephusProblem.jl, please consider giving us a formal citation: citation.bib.