约瑟夫问题: 有n个小孩围成一圈,给他们从1开始依次编号,从编号为1的小孩开始报数, 数到第m个小孩出列,然后从出列的下一个小孩重新开始报数,数到 第m个小孩又出列,…,如此反复直到所有的小孩全部出列为止,求 整个出列序列。 如当n=6,m=5时的出列序列是5,4,6,2,3,1。
Joseph's question: There are n children in a circle, number them starting from 1, and start counting from the child with the number 1, Count to the mth child in the column, then start counting again from the next child in the column The mth child is listed again... Repeat this process until all the children are listed, and ask for The entire listing sequence. When n=6 and m=5, the output sequence is 5, 4, 6, 2, 3, 1.