Let $d$ be any positive integer not equal to $2, 5,$ or $ 13$ , then $\exists a, b \in \{2, 5, 13, d\}$ such that $ab − 1$ is not a perfect square? Let $d$ be any positive integer not equal to $2, 5,$ or $ 13$. Then can we always find
distinct $a, b \in \{2, 5, 13, d\}$ such that $ab − 1$ is not a perfect square ?
 A: This is IMO 1986 Problem 1.
You can find a solution here (or here).
If $d$ is equal to $2,5$ or $13$, then $2d-1$, $5d-1$, $13d-1$ are not perfect squares respectively, so the restriction of $d$ to be neither of $2,5,13$ unnecessarily makes the statement less general.
It works for any integer $d$, even negative or zero.
The latter are trivial cases and so let's assume that $d\ge 1$.
Clearly one of $a,b$ must be $d$, since $2\cdot 13-1=5^2, 2\cdot 5-1=3^2, 5\cdot 13 -1=8^2$, and they can't both be $d$ because the problem says $a,b$ are distinct.
So the problem then becomes - show that at least one of $2d-1, 5d-1, 13d-1$ is not a perfect square.  
Assume the contrary for a contradiction - $2d-1, 5d-1, 13d-1$ are all perfect squares.  
Quadratic residues modulo $16$ are $0,1,4,9$, so it is a necessary condition that all of $2d-1, 5d-1, 13d-1$ are each one of $0,1,4,9$ modulo $16$.  
We'll prove this is not the case and so we'll get a contradiction.
$2d-1\equiv $ one of $0,1,4,9$ modulo $16$ iff $d$ is one of $1,5,9,13$ modulo $16$.  
If $d$ is $1$ or $13$ modulo $16$, then $13d-1\equiv 12$ or $8$ modulo $16$ (respectively), but it must be one of $0,1,4,9$ - impossible.
If $d$ is $5$ or $9$ modulo $16$, then $5d-1\equiv 8$ or $12$ modulo $16$ (respectively), but it must be one of $0,1,4,9$ - impossible.
Contradiction.
A: Note that $2\cdot 5-1=9$, $2\cdot13-1=25$, and $5\cdot15-1=64$. These are all perfect squares. Thus, there exists $a$ and $b$ such that $ab-1$ is a perfect square if and only if at least one of
$$2d-1, 5d-1, \text{ or } 13d-1$$
is a perfect square.
We will continue by contradiction. Assume temporarily that all of these are perfect squares. We then have
$$2d-1=x^2,$$
$$5d-1=y^2,$$
and
$$13d-1=z^2$$
for positive integers $x$, $y$, and $z$.
We will now split this into two cases: $d$ is even and $d$ is odd.
If $d$ is even, then $x^2\equiv 3\pmod{4}$. This is not possible, so $d$ must be odd. If $d\equiv 3\pmod{4}$, then $y^2\equiv 2\pmod{4}$. This is not possible either so, then $d\equiv 1\pmod{4}$.
Let $d=4n+1$, where $n$ is an integer. Substituting this into our three equations, we get
$$8n+1=x^2,$$
$$20n+4=y^2,$$
and
$$52n+12=z^2.$$
Since $4$ is a perfect square, an integer divisible by $4$ is a perfect square iff you get a perfect square when you divide it by $4$. So we can factor out a $4$ from the second two equations. So we have
$$5n+1=y'^2$$
and
$$13n+3=z'^2$$
where $y'$, and $z'$ are integers. Using the last two equations and taking mod $4$, we find that $n+1$ and $n+3$ are both equivalent to either $0$ or $1 \pmod{4}$. This is not possible, so we have a contradiction. $\blacksquare$
