- #1

Arman777

Gold Member

- 1,985

- 166

__Consider quadratic Diophantine equations of the form:__

For example, when D=13, the minimal solution in

It can be assumed that there are no solutions in positive integers when D is square.

By finding minimal solutions in

3

2

9

5

8

Hence, by considering minimal solutions in

Find the value of D ≤ 1000 in minimal solutions of

*x*– D^{2}*y*= 1^{2}For example, when D=13, the minimal solution in

*x*is 6492 – 13×1802 = 1.It can be assumed that there are no solutions in positive integers when D is square.

By finding minimal solutions in

*x*for D = {2, 3, 5, 6, 7}, we obtain the following:3

^{2}– 2×2^{2}= 12

^{2}– 3×1^{2}= 19

^{2}– 5×4^{2}= 15

^{2}– 6×2^{2}= 18

^{2}– 7×3^{2}= 1Hence, by considering minimal solutions in

*x*for D ≤ 7, the largest*x*is obtained when D=5.Find the value of D ≤ 1000 in minimal solutions of

*x*for which the largest value of*x*is obtained.Any idea how to solve this ?

I made a code but its slow. I find some information about the general solution but I didnt understand it much.

http://mathworld.wolfram.com/PellEquation.html

Python:

```
import time
start = time.perf_counter()
Number = [i for i in range(2,1001)]
Sq1 = [i**2 for i in range(2,int(1001**0.5))]
for i in Sq1:
Number.remove(i)
D_high_values =[]
x_initial = 3
for D in Number:
for x in range(2,10**5):
y = ((x**2-1)/D)
k = str(y**0.5)
if k[-1] == "0" and k[-2] ==".": #testing if the square root is integer
if x_initial < x:
x_initial = x
break
else:
D_high_values.append(D) #collecting values that have larger x value then 10**5
print(D_high_values)
print(x_initial) #highest minimal x up to 10**5
end = time.perf_counter()
print("Time to solve:",end-start)
```

I noticed that theres 427 -D- values which their minimal x values are larger then 10**5. So I dont think brute force can give the solution.