A New 0(klog n) Algorithm for Josephus Problem
Hikaru Manabe, Ryohei Miyadera, Yuji Sasaki, Shoei Takahashi, Yuki, Tokuni

TL;DR
This paper introduces a non-recursive, space-efficient O(k log n) algorithm for the Josephus problem, leveraging a relation with Nim from combinatorial game theory, especially effective for small k and large n.
Contribution
It presents a novel non-recursive algorithm with improved space complexity for the Josephus problem, connecting it to Nim theory.
Findings
Algorithm has O(k log n) time complexity.
Space complexity is reduced to O(1).
Performance is better for small k and large n.
Abstract
We present a new O(k log n) algorithm of the Josephus problem. The time complexity of our algorithm is O(k log n), and this time complexity is on a par with the existing O(k log n) algorithm. We do not have any recursion overhead or stack overflow because we do not use any recursion. Therefore, the space complexity of our algorithm is O(1), and ours is better than the existing O(k log n) algorithm in this respect. When k is small and n is large, our algorithm is better than the existing O(k log n) algorithm. This new algorithm is based on a relation between the Josephus problem and a maximum Nim of combinatorial game theory.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsPolynomial and algebraic computation · Advanced Mathematical Identities
