About 86,600 results
Open links in new tab
  1. Josephus problem - Wikipedia

    In computer science and mathematics, the Josephus problem (or Josephus permutation) is a theoretical problem related to a certain counting-out game. Such games are used to pick out a person from a group, e.g. eeny, meeny, miny, moe .

  2. Josephus Problem - GeeksforGeeks

    Feb 20, 2025 · The problem has the following recursive structure. josephus (n, k) = (josephus (n – 1, k) + k-1) % n + 1 and josephus (1, k) = 1. After the first person (kth from the beginning) is killed, n-1 persons are left. Make recursive call for Josephus (n …

  3. The Josephus problem is based around Josephus Flavius; a Jewish soldier and historian who inspired an interesting set of mathematical problems. In 67 C.E., Josephus and 40 fellow soldiers were surrounded by a group of Roman soldiers who were intent on capturing them.

  4. Josephus Problem -- from Wolfram MathWorld

    Apr 18, 2025 · The original Josephus problem consisted of a circle of 41 men with every third man killed (, ), illustrated above, where the outer number indicates the order in which a given man is killed. In order for the lives of the last two men to be spared, they must be placed at positions 31 (last) and 16 (second-to-last).

  5. Josephus problem | Practice | GeeksforGeeks

    Determine the index at which you should stand to survive the game. Return an integer denoting safe position. Examples : Output: 3 . Explanation: There are 3 persons so skipping 1 person i.e 1st person 2nd person will be killed. Thus the safe position is 3. Output: 4 .

  6. Josephus Problem – GeoGebra

    The Problem: People are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction.

  7. Josephus Problem - InterviewBit

    Aug 18, 2023 · Q.1: What data structure is used in solving the Josephus problem? Q.2: How to solve the Josephus problem?

  8. Solve This Deadly Puzzle! Investigating the Josephus Problem

    Jun 2, 2020 · Here's a neat fact about the Josephus problem. If you express the number of soldiers in binary, then merely moving the first digit to the end gives you the desired position. For example, if the number of soldiers is 5, the desired position …

  9. Josephus problem - Algorithms for Competitive Programming

    This task was set by Flavius Josephus in the 1st century (though in a somewhat narrower formulation: for $k = 2$). This problem can be solved by modeling the procedure. Brute force modeling will work $O(n^{2})$ .

  10. Understanding the Josephus Problem: A Comprehensive Guide

    Jul 9, 2024 · To solve this problem optimally, we can use the mathematical approach known as the Josephus problem, which has a well-known efficient solution. The optimal approach leverages the recursive formula of the Josephus problem to find the winner in (O(n)) time and (O(1)) space.

Refresh