JosephusCS - The Flavius Josephus Permutation Program

Download

JosephusCS is a program that solves the Josephus Permutation problem:

Original Problem: 1000 slaves in a circle, numbered 1 to 1000, are all
to be shot except one lucky survivor. The order of shooting is 1, 3,
5, etc., always alternating, and always immediately removing the
fallen bodies. Once a body has fallen, it is no longer considered part
of the circle for purposes of future counting and alternation.
Example, n=6: Shoot 1,3,5,2,6; 4 survives.

The General Problem: There is an ordered set of n objects arranged
in a circle with object i (1 <= i <= n) in position i. All n objects are
selected and removed in a certain order and placed in a new circle
with the new position number k beings the order of selection. Object
f is selected first. After each selection, m minus 1 of the remaining
objects following the one removed are skipped and the next object
is then selected. We are interested in the nature of the permutation
generated by this process, its fixed elements, and in particular the
original position L of the last object selected. Note that m and f can
be as low as 1 and can be larger than n.

n = The number of objects in the circle
f = index of first object to be selected [1, n]
m = difference in index of items selected, m = 2 => every other

This page accessed times since July 8, 2008.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Sunday, 27-Jul-08 17:03:53 PDT