Josephus Problem Visualizer

n people in a circle, every k-th eliminated — who survives?

Parameters

Survivor (1-indexed)
Formula: J(n,k)
Elimination order:
k=2 formula: J(n) = 2L + 1, where n = 2^m + L (L < 2^m).

General: J(1,k)=0; J(n,k)=(J(n−1,k)+k) mod n (0-indexed).

Historical: Flavius Josephus (37 AD) — 41 Jewish rebels; he and a friend survived by choosing positions 16 and 31 in a count-by-3 circle.