Prime and consecutive numbers

Solution 1:

First, if $q=2$, we must have $p=3$. This case is trivial, since $p$ and $q$ are consecutive primes. From now on, assume that $q>2$.

Claim: There exist positive integers $a,b$ with $a$ even, $b<q$ and $aq-bp:=\varepsilon\in\{\pm 1\}$.

Proof: Find $x_0,y_0\in\mathbb{Z}$ such that $x_0q-y_0p=1$. Note that $(x_0+kp)q-(y_0+kq)p=1$ for all $k\in\mathbb{Z}$. Pick $k_0$ such that $0<y_0+k_0q<q$. If $x_0+k_0p$ is even, pick $a:=x_0+k_0p$ and $b:=y_0+k_0q$. If $x_0+k_0p$ is odd, pick $a=(1-k_0)p-x_0$ and $b:=(1-k_0)q-y_0$. $\square$


Now, let $a,b$ as in the claim and set $n:=aq$. It is trivial that $q\mid n$ and $p\mid n+\varepsilon$. We have to show that these are the largest prime divisors.

First, it is clear that $(n+\varepsilon)/p=b<q<p$, so $p$ is the largest prime factor of $n+\varepsilon$. Next, $2q\mid n$, and $$ \frac{n}{2q} = \frac{bp+\varepsilon}{2q}=\frac{p}{2q}\cdot\frac{bp}{p}+\frac{\varepsilon}{2q} <b+\frac{\varepsilon}{2q}, $$ so $n/2q<q$ and because $q>2$, the largest prime factor of $n$ is $q$.