You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def number_of_solution(p):
num = 0
for a in range(1,p//3):
if (p**2-2*p*a)%(2*p-2*a) == 0:
if a > (p**2-2*p*a)//(2*p-2*a): break # bug fixed here
num += 1
return num
def main(n=1000):
d = {p:number_of_solution(p) for p in range(2,n+1,2)}
ans = max(d,key=d.get)
return ans
The text was updated successfully, but these errors were encountered:
https://pe.metaquant.org/pe039.html
对于同一个p,计算a和b可能重复,加个大小判断就可以
The text was updated successfully, but these errors were encountered: