The
Josephus
Problem
The Josephus Problem
 In computer science and mathematics, the Josephus
problem (or Josephus permutation) is a theoretical problem
related to a certain counting-out game.
 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. After a specified number of people
are skipped, the next person is executed. The procedure is
repeated with the remaining people, starting with the next
person, going in the same direction and skipping the same
number of people, until only one person remains, and is freed.
The Josephus Problem
The problem is named after Flavius Josephus, a Jewish
historian living in the 1st century. According to Josephus'
account of the siege of Yodfat, he and his 40 soldiers were
trapped in a cave by Roman soldiers. They chose suicide
over capture, and settled on a serial method of
committing suicide by drawing lots. Josephus states that
by luck or possibly by the hand of God, he and another
man remained until the end and surrendered to the
Romans rather than killing themselves. This is the story
given in Book 3, Chapter 8, part 7 of Josephus' The Jewish
War
The Josephus Problem
Variation of the problem
we start with n people numbered 1 to n
around a circle
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1
6
7
8
9
10 2
3
4
5
The Josephus Problem
1 1
j jn
The Josephus Problem
2 1
j jn
1
1jn
j
The Josephus Problem
3 3
j jn
1
1
2
1
j
jn
The Josephus Problem
4 1
j jn
1
1
2
1
3
3
j
jn
The Josephus Problem
5 3
j jn
1
1
2
1
3
3
4
1
j
jn
The Josephus Problem
6 5
j jn
1
1
2
1
3
3
4
1
5
3
j
jn
The Josephus Problem
7 7
j jn
1
1
2
1
3
3
4
1
5
3
6
5
j
jn
The Josephus Problem
8 1
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
j
jn
The Josephus Problem
9 3
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
j
jn
The Josephus Problem
10 5
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
j
jn
The Josephus Problem
11 7
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
j
jn
The Josephus Problem
12 9
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
j
jn
The Josephus Problem
13 11
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
j
jn
The Josephus Problem
14 13
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
j
jn
The Josephus Problem
15 15
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
j
jn
The Josephus Problem
16 1
j jn
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
The Josephus Problem
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
The Josephus Problem
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
The Josephus Problem
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
The Josephus Problem
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
2
n
The Josephus Problem
1
1
2
1
3
3
4
1
5
3
6
5
7
7
8
1
9
3
10
5
11
7
12
9
13
11
14
13
15
15
16
1
j
jn
j
jn
32
1
64
1
128
1
256
1
512
1
1024
1
2048
1
4096
1
8192
1
The Josephus Problem
Bit
D-B
1
1
2
0
4
0
8
1
16
0
32
1
64
41
N = 41
B-D 1 1 0 0 1 0 19
32+8+1 = 41 16+2+1 = 19
=
=
The Josephus Problem
41 19
j jn
The Josephus Problem
Recurrent equation
J (1) = 1;
J (2n) = 2J (n) – 1; for n≥1
J (2n+1) = 2J (n) + 1; for n≥1
EVEN
ODD
The Josephus Problem
Recurrent equation
J(41) = 2 J(20)+1 = 2 x 9 + 1 = 19
J(20) = 2 J(10)-1 = 2 x 5 - 1 = 9
J(10) = 2 J(5)-1 = 2 x 3 - 1 = 5
J(5) = 2 J(2)+1 = 2 x 1 + 1 = 3
J(2) = 2 J(1)-1 = 2 x 1 - 1 = 1
J(1) = 1
The Josephus Problem
Close Formula
41 = 2 +9 = 2x9+15
= 19
The Josephus Problem
Thank
You

More Related Content

PPTX
Pointers,virtual functions and polymorphism cpp
PPTX
Unit 1 polynomial manipulation
PDF
Python lambda functions with filter, map & reduce function
PPT
Lower bound
PPTX
Counting sort
PPTX
Python Collections
PPT
Recursion.ppt
PPTX
CLOSEST PAIR (Final)
Pointers,virtual functions and polymorphism cpp
Unit 1 polynomial manipulation
Python lambda functions with filter, map & reduce function
Lower bound
Counting sort
Python Collections
Recursion.ppt
CLOSEST PAIR (Final)

What's hot (20)

PPTX
8. sql
PDF
JavaScript - Chapter 12 - Document Object Model
PPT
MySQL Functions
PDF
Alter table command
PPT
JavaScript Arrays
DOCX
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
PPTX
Transaction states and properties
PPTX
Dom(document object model)
PPTX
DataFrame in Python Pandas
PPTX
String Manipulation in Python
PPTX
PPTX
Kruskal Algorithm
PPTX
Dictionaries and Sets in Python
PPT
Mysql Ppt
PDF
stacks and queues
PPTX
HTML: Tables and Forms
PPTX
(floyd's algm)
PPT
Stack Operation In Data Structure
PDF
jQuery for beginners
PPTX
Stack and Queue by M.Gomathi Lecturer
8. sql
JavaScript - Chapter 12 - Document Object Model
MySQL Functions
Alter table command
JavaScript Arrays
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Transaction states and properties
Dom(document object model)
DataFrame in Python Pandas
String Manipulation in Python
Kruskal Algorithm
Dictionaries and Sets in Python
Mysql Ppt
stacks and queues
HTML: Tables and Forms
(floyd's algm)
Stack Operation In Data Structure
jQuery for beginners
Stack and Queue by M.Gomathi Lecturer
Ad

Recently uploaded (20)

PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
International_Financial_Reporting_Standa.pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
Virtual and Augmented Reality in Current Scenario
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
Trump Administration's workforce development strategy
PDF
HVAC Specification 2024 according to central public works department
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Hazard Identification & Risk Assessment .pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
International_Financial_Reporting_Standa.pdf
B.Sc. DS Unit 2 Software Engineering.pptx
Virtual and Augmented Reality in Current Scenario
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Uderstanding digital marketing and marketing stratergie for engaging the digi...
Weekly quiz Compilation Jan -July 25.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
A powerpoint presentation on the Revised K-10 Science Shaping Paper
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Trump Administration's workforce development strategy
HVAC Specification 2024 according to central public works department
Environmental Education MCQ BD2EE - Share Source.pdf
Computer Architecture Input Output Memory.pptx
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Ad

Josephus problem