求循环小数的开始位置(小数点之后的位数)和循环长度(Python3)

首先要清楚,循环小数中,一个循环内相同的数是不会出现两次的,循环数的范围又在0~9。  Python3代码如下: def function(a,b): index = 0 d = collections.defaultdict(int) while True: remainder = a%b if not remainder:
相关文章
相关标签/搜索