Pregunta de entrevista de headstrait

The Josephus Problem Program question