【发布时间】:2021-01-05 04:30:25
【问题描述】:
我试过这个代码
p = 1000003
q = 400003
M = p*q
n = 84480
X = [6225**2%M]
new = X[0]**2%M
i = 1
while new not in X and len(X) < n:
X.append(new)
new = X[i]**2%M
i += 1
.append 语法需要一段时间来构建列表。我需要另一种语法来更快地创建列表,因为n 非常大。
【问题讨论】:
标签: python list performance append