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 4024628 commit 975bcd0Copy full SHA for 975bcd0
dixon.py
@@ -1,7 +1,7 @@
1
from gmpy2 import isqrt,gcd,next_prime
2
import sys
3
4
-def dixon(N,B=100):
+def dixon(N,B=7):
5
6
tmp = []
7
pairs = []
@@ -15,23 +15,28 @@ def primes(B):
15
return tmp
16
17
base = primes(B)
18
+
19
+ #print(base)
20
21
start = isqrt(N)
22
i = start
23
while i<=N:
24
for j in range(len(base)):
25
l = pow(i,2, N)
26
r = pow(base[j],2,N)
27
+ #print(i,j,l,r)
28
if l == r:
29
pairs.append([i,base[j]])
- print(pairs)
30
+ #print(pairs)
31
i+=1
32
33
34
35
for i in range(len(pairs)):
36
x = pairs[i][0]
37
y = pairs[i][1]
- tmp.append(gcd(x-y,N))
-
- return tmp
38
+ f = (gcd(x-y,N))
39
+ if 1 < f < N:
40
+ return f,N//f
41
42
print(dixon(int(sys.argv[1])))
0 commit comments