【发布时间】:2020-07-16 14:50:28
【问题描述】:
我正在尝试以 m*n | 的因子计算有序对 m,n x-1。问题是 x 是 1.1 * 10^6 位长,而 m 和 n 是 5*10^5 位长。我想知道内置的 pow 是否会给我正确的答案。我无法检查 1000000 位数的值,也无法在 python 中找到关于非常大数字的任何文档。 我的代码如下。
x=pow(2,3628800)
for n in factors:
for m in factors:
if x%(m*n)==1:
ans+=1
i+=1
print(i)
print(ans)
【问题讨论】:
标签: python math largenumber exponentiation factorization