2
我試圖做一個函數來計算三個變量的模指數和比較CPU和牆壁的時候:Python的內存錯誤
e=2^n and e=2^n-1
這裏是我的代碼:
from random import choice
import random
def question_3(m,n):
list = []
for i in range(2,2**m):
flag=True
for num in list:
if(i%num==0):
flag=False
if(flag):
list.append(i)
p = choice(list)
a = randint(1,int(p)-1)
e = pow(2,n)
return pow(a,e,p)
time t = question_3(150,100)
但是,當我進入m和n與龐大的數字,它給了我:
range() result has too many items