6174猜想:一个任意的四位正整数(全相同的除外,如1111)。将数字重新组合成一个最大的数和最小的数相减,重复这个过程,最多七步,必得6174。
还有一个数是495,和6174一个道理,一个任意的三位正整数,然后排列最大减去最小,重复下去一直到495
用python3实现:
1 |
# -*- coding: utf-8 -*- |
下面是运行结果:
6174猜想:一个任意的四位正整数(全相同的除外,如1111)。将数字重新组合成一个最大的数和最小的数相减,重复这个过程,最多七步,必得6174。
还有一个数是495,和6174一个道理,一个任意的三位正整数,然后排列最大减去最小,重复下去一直到495
用python3实现:
1 |
# -*- coding: utf-8 -*- |
下面是运行结果:
近期评论