摘要:
def demo(m, n): if m > n: m, n = n, m p = m * n while m != 0: r = n % m n = m m = r return (int(p / n), n) val = demo(20, 30) print('最小公倍数为:', val[0])... 阅读全文
摘要:
def demo(t): print([1]) print([1, 1]) line = [1, 1] for i in range(2, t): r = [] for j in range(0, len(line) - 1): r.append(line[j] + line[j + 1]) ... 阅读全文
摘要:
def fib(n): a, b = 1, 1 while a < n: print(a, end=' ') a, b = b, a + b fib(100000) #输出结果 #1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 2865... 阅读全文