摘要
文章主要利用Python语言讨论解决n-2型Josephus问题。首先,通过计算机模拟求解,其次分析问题的实质,得到递推关系并通过递归函数求解,再次,以n的取值为2的次幂为分界点进行分组,观察解的模式来猜测解的解析式。通过数学归纳法证明了猜测的正确性,最终得出解可以通过循环左移1位获取。通过深入浅出地对n-2型Josephus问题进行分析和求解,有助于提高在数学问题思考方面的能力和水平。
The article mainly uses Python language to discuss and solve the n-2 type Josephus problem.Firstly,the solution is solved through computer simulation.Secondly,the essence of the problem is analyzed to obtain a recursive relationship and solved through a recursive function.Thirdly,the solution is grouped using the power of n to the power of 2 as the boundary point,and the pattern of the solution is observed to guess the analytical formula of the solution.The correctness of the conjecture was proven through mathematical induction,and the final solution can be obtained by cyclically shifting one position to the left.Analyzing and solving the n-2 type Josephus problem in a simple and easy manner can help improve one's ability and level of thinking in mathematical problems.
作者
黄绍龙
HUANG Shaolong(College of Mathematics and Science,Luoyang Normal University,Luoyang,Henan 471934,China)
出处
《计算机应用文摘》
2023年第24期87-89,共3页
Chinese Journal of Computer Application
关键词
计算机模拟
递归函数
数学归纳法
循环左移位
computer simulation
recursive function
mathematical induction
cyclic shift