2019-03-23 12:07:31 -07:00
2019-03-23 12:07:31 -07:00
2019-03-18 20:28:30 -07:00
2019-03-12 21:59:32 -07:00
2019-03-12 21:58:54 -07:00

Josephus Problem (Improved)

a.k.a., The Sushi Boat Problem

There are n plates of sushi on sushi boats. Each plate of sushi is labeled 1 to n and is arranged in a linked circle of sushi boats. The sushi boats move by in a small canal in front of you.

Beginning at plate 1, you count m plates of sushi, stopping at every mth plate to eat it. When you eat a plate of sushi, you remove the numbered plate from the boat.

In what order will the plates be stacked on our plate, starting with the top plate?

Description
Code for exercises about the Josephus problem from Knuth's Art of Computer Programming, Volume 1.
Readme 198 KiB
Languages
TeX 88.2%
Python 11%
Shell 0.8%