SlideShare a Scribd company logo
1 of 1
Download to read offline
( Josephus Problem ) In the Josephus problem from antiquity, n people are in dire straits and
agree to the following strategy to reduce the population. They arrange themselves in a circle (at
positions numbered from 1 to n ) and proceed around the circle, eliminating every m th person
until only one person is left. Legend has it that Josephus figured out where to sit to avoid being
eliminated. Implement a program Josephus.java that accepts n (int) and m (int) as command-line
arguments, and writes to standard output the order in which people are eliminated (and thus
would show Josephus where to sit in the circle).

More Related Content

More from aone2010

(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf
(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf
(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdfaone2010
 
(Hint- use induction on the sequence of operations- check the proof of.pdf
(Hint- use induction on the sequence of operations- check the proof of.pdf(Hint- use induction on the sequence of operations- check the proof of.pdf
(Hint- use induction on the sequence of operations- check the proof of.pdfaone2010
 
(Explain)(1) cconomic equality is one of the most important characteri.pdf
(Explain)(1) cconomic equality is one of the most important characteri.pdf(Explain)(1) cconomic equality is one of the most important characteri.pdf
(Explain)(1) cconomic equality is one of the most important characteri.pdfaone2010
 
(Fill in the blank) Patterns are the behavior- derived from the relati.pdf
(Fill in the blank) Patterns are the behavior- derived from the relati.pdf(Fill in the blank) Patterns are the behavior- derived from the relati.pdf
(Fill in the blank) Patterns are the behavior- derived from the relati.pdfaone2010
 
(e) P(0-76z0-54) (f) P(z-3).pdf
(e) P(0-76z0-54) (f) P(z-3).pdf(e) P(0-76z0-54) (f) P(z-3).pdf
(e) P(0-76z0-54) (f) P(z-3).pdfaone2010
 
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdfaone2010
 
(C++) Write a car rental application- Things that you need to impleme.pdf
(C++) Write a car rental application-  Things that you need to impleme.pdf(C++) Write a car rental application-  Things that you need to impleme.pdf
(C++) Write a car rental application- Things that you need to impleme.pdfaone2010
 
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdfaone2010
 
(d) Click the icon to view the data table (Type an integer or a decima.pdf
(d) Click the icon to view the data table (Type an integer or a decima.pdf(d) Click the icon to view the data table (Type an integer or a decima.pdf
(d) Click the icon to view the data table (Type an integer or a decima.pdfaone2010
 
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdfaone2010
 
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdfaone2010
 
(PE12-7) Create a Windows application that has the functionality of.pdf
(PE12-7) Create a Windows application that has    the functionality of.pdf(PE12-7) Create a Windows application that has    the functionality of.pdf
(PE12-7) Create a Windows application that has the functionality of.pdfaone2010
 
(Pskip)- skip.pdf
(Pskip)- skip.pdf(Pskip)- skip.pdf
(Pskip)- skip.pdfaone2010
 
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdfaone2010
 
(Maximum and minimum) Implement the following functions that find the.pdf
(Maximum and minimum) Implement the following functions that find the.pdf(Maximum and minimum) Implement the following functions that find the.pdf
(Maximum and minimum) Implement the following functions that find the.pdfaone2010
 
(Multiple choice) Given the following class definition- class employee.pdf
(Multiple choice) Given the following class definition- class employee.pdf(Multiple choice) Given the following class definition- class employee.pdf
(Multiple choice) Given the following class definition- class employee.pdfaone2010
 
(In C++) Code a singly linked list where each node includes 3 differen.pdf
(In C++) Code a singly linked list where each node includes 3 differen.pdf(In C++) Code a singly linked list where each node includes 3 differen.pdf
(In C++) Code a singly linked list where each node includes 3 differen.pdfaone2010
 
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdfaone2010
 
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdfaone2010
 
(i) Multiple answers- Multiple answers are accepted for this question.pdf
(i) Multiple answers- Multiple answers are accepted for this question.pdf(i) Multiple answers- Multiple answers are accepted for this question.pdf
(i) Multiple answers- Multiple answers are accepted for this question.pdfaone2010
 

More from aone2010 (20)

(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf
(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf
(I) A randots dample of boemser (i- millinss of deliand paid by lurge.pdf
 
(Hint- use induction on the sequence of operations- check the proof of.pdf
(Hint- use induction on the sequence of operations- check the proof of.pdf(Hint- use induction on the sequence of operations- check the proof of.pdf
(Hint- use induction on the sequence of operations- check the proof of.pdf
 
(Explain)(1) cconomic equality is one of the most important characteri.pdf
(Explain)(1) cconomic equality is one of the most important characteri.pdf(Explain)(1) cconomic equality is one of the most important characteri.pdf
(Explain)(1) cconomic equality is one of the most important characteri.pdf
 
(Fill in the blank) Patterns are the behavior- derived from the relati.pdf
(Fill in the blank) Patterns are the behavior- derived from the relati.pdf(Fill in the blank) Patterns are the behavior- derived from the relati.pdf
(Fill in the blank) Patterns are the behavior- derived from the relati.pdf
 
(e) P(0-76z0-54) (f) P(z-3).pdf
(e) P(0-76z0-54) (f) P(z-3).pdf(e) P(0-76z0-54) (f) P(z-3).pdf
(e) P(0-76z0-54) (f) P(z-3).pdf
 
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf
(c) The SOP form of a function is f(a-b-c)-m(0-1)- Give the POS of its.pdf
 
(C++) Write a car rental application- Things that you need to impleme.pdf
(C++) Write a car rental application-  Things that you need to impleme.pdf(C++) Write a car rental application-  Things that you need to impleme.pdf
(C++) Write a car rental application- Things that you need to impleme.pdf
 
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf
(DuPont analysis)Triangular Chemicals has total assets of $ 97 million.pdf
 
(d) Click the icon to view the data table (Type an integer or a decima.pdf
(d) Click the icon to view the data table (Type an integer or a decima.pdf(d) Click the icon to view the data table (Type an integer or a decima.pdf
(d) Click the icon to view the data table (Type an integer or a decima.pdf
 
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf
(c) Suppose events A and B partition a sample space S- where A and B h (1).pdf
 
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf
(Preparing a balance sheet) Prepare a balance sheet from the informati.pdf
 
(PE12-7) Create a Windows application that has the functionality of.pdf
(PE12-7) Create a Windows application that has    the functionality of.pdf(PE12-7) Create a Windows application that has    the functionality of.pdf
(PE12-7) Create a Windows application that has the functionality of.pdf
 
(Pskip)- skip.pdf
(Pskip)- skip.pdf(Pskip)- skip.pdf
(Pskip)- skip.pdf
 
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf
(b) The POS form of a function is f(a-b-c-d)-M(0-7-9)- Give its SOP in.pdf
 
(Maximum and minimum) Implement the following functions that find the.pdf
(Maximum and minimum) Implement the following functions that find the.pdf(Maximum and minimum) Implement the following functions that find the.pdf
(Maximum and minimum) Implement the following functions that find the.pdf
 
(Multiple choice) Given the following class definition- class employee.pdf
(Multiple choice) Given the following class definition- class employee.pdf(Multiple choice) Given the following class definition- class employee.pdf
(Multiple choice) Given the following class definition- class employee.pdf
 
(In C++) Code a singly linked list where each node includes 3 differen.pdf
(In C++) Code a singly linked list where each node includes 3 differen.pdf(In C++) Code a singly linked list where each node includes 3 differen.pdf
(In C++) Code a singly linked list where each node includes 3 differen.pdf
 
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf
(i- (Click the icon to view the transactions-) Requirements 1- Journal.pdf
 
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf
(ii) dx3d3y+3(dxdy)3+2dxdy-0 (iv) dx3d3y-0.pdf
 
(i) Multiple answers- Multiple answers are accepted for this question.pdf
(i) Multiple answers- Multiple answers are accepted for this question.pdf(i) Multiple answers- Multiple answers are accepted for this question.pdf
(i) Multiple answers- Multiple answers are accepted for this question.pdf
 

Recently uploaded

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

(Josephus Problem) In the Josephus problem from antiquity- n people ar.pdf

  • 1. ( Josephus Problem ) In the Josephus problem from antiquity, n people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 1 to n ) and proceed around the circle, eliminating every m th person until only one person is left. Legend has it that Josephus figured out where to sit to avoid being eliminated. Implement a program Josephus.java that accepts n (int) and m (int) as command-line arguments, and writes to standard output the order in which people are eliminated (and thus would show Josephus where to sit in the circle).