Calculators
Josephus Calculator
Find the last survivor in a circular elimination sequence from the participant count and counting step, privately in your browser.
Number participants 1 through n around a circle. Start counting at position 1, remove every kth person, and resume counting at the next remaining person. Enter n and k from 1 to 1000000. Calculations stay in your browser.
Find the surviving position in the Josephus problem.
Label n participants from 1 through n around a circle. Count position 1 as the first person, eliminate the kth person, and restart counting at 1 with the next remaining person. Continue until one remains. For n = 7 and k = 3, the elimination order is 3, 6, 2, 7, 5, 1 and the survivor is position 4. The calculator returns the original one-based position, not an elimination list. Internally it uses the zero-based recurrence J(1, k) = 0 and J(m, k) = (J(m − 1, k) + k) mod m, then adds one. A single participant survives at position 1; a step of 1 leaves position n. Enter whole numbers from 1 to 1000000 for both inputs. Leading zeros and surrounding whitespace are accepted within seven digits; signs, decimals, separators and scientific notation are rejected. The recurrence takes linear time and constant memory, with exact integer arithmetic throughout these bounds. Your inputs stay in the browser.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
Where does counting start?
At position 1, counted as the first person. Remove the kth person and resume counting from 1 at the next remaining person.
What is the survivor for seven people and step three?
Position 4 survives. The other positions are removed in order: 3, 6, 2, 7, 5, 1.
Can the step exceed the number of participants?
Yes. Counting wraps around the remaining circle as many times as needed.
What happens for a step of one?
People are removed in order from position 1, so the survivor is position n. With one participant the survivor is always position 1.
How is the result calculated?
Use J(1, k) = 0 and J(m, k) = (J(m − 1, k) + k) mod m, then add one for the original one-based position. The allowed bounds keep all arithmetic exact.
Are inputs uploaded?
No. The calculator runs entirely in your browser.