import json MOD = 10 ** 9 + 7 lst = [1] for x in range(1, 100_000): lst.append((lst[-1] * x) % MOD) with open('mod.json','w') as f: json.dump(lst, f)