I'm trying to solve the following Diophantine equation using Mathematica:
$$2^x=5^y+3$$

I have a code,but is very slow. Can we speed up ?

```
f[x_?IntegerQ, y_?IntegerQ] := 2^x - 5^y;
M = 2000;
sol = Thread[{x, y} -> #] & /@ (Most /@ 
Select[Flatten[Table[{x, y, f[x, y] == 3}, {x, 0, M}, {y, 0, M}], 
1], #[[3]] &]) // AbsoluteTiming

(* {50.2135, {{x -> 2, y -> 0}, {x -> 3, y -> 1}, {x -> 7, y -> 3}}}*)

```

Another code with `For` function:

```
For[i = 0, i <= M, i++, 
For[j = 0, j <= M, j++, 
If[f[i, j] == 3, Print[{i, j}]]]] // AbsoluteTiming

(*{49.4506, Null}*)

```

Calculating time is about 50 second.
[![enter image description here](https://i.stack.imgur.com/gLgPO.png)](https://i.stack.imgur.com/gLgPO.png)

In Maple with `M=2000`,Maple can solve this with about `2.094` second.