Skip to content

Commit cd3311a

Browse files
committed
Another.
Sympy and networkx, man; I'm tellin' ya
1 parent 5b8bdd7 commit cd3311a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

66.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import operator
2+
3+
from sympy.solvers.diophantine.diophantine import diop_DN
4+
5+
6+
def min_x(x_y_tuples):
7+
return min(x_y_tuples, key=operator.itemgetter(0))
8+
9+
10+
def solution_for(D):
11+
solutions = diop_DN(D, 1)
12+
return min_x(solutions)
13+
14+
15+
solutions = [(solution_for(D), D) for D in range(2, 1001)]
16+
print(max(solutions, key=operator.itemgetter(0)))
17+
# ((16421658242965910275055840472270471049, 638728478116949861246791167518480580), 661)

0 commit comments

Comments
 (0)