We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69f6c68 commit dc409e1Copy full SHA for dc409e1
dixon.py
@@ -15,21 +15,19 @@ def primes(B):
15
start = isqrt(N)
16
i = start
17
18
- i2N = []
19
- while i<=N:
20
- i2N.append(pow(i,2,N))
21
- i+=1
22
-
23
basej2N = []
24
for j in range(0,len(base)):
25
basej2N.append(pow(base[j],2,N))
26
27
- for i in range(0,len(i2N)):
+ i2N = []
+ while i < N:
+ i2N = pow(i,2,N))
28
for k in range(0,len(base)):
29
- if i2N[i] == basej2N[k]:
30
- f=gcd(start + i - base[k],N)
+ if i2N == basej2N[k]:
+ f=gcd(i - base[k],N)
31
if 1 < f < N:
32
return f,N//f
+ i+=1
33
return -1
34
35
print(dixon(int(sys.argv[1])))
0 commit comments