Problem

Source: 2015 Belarus TST 5.1

Tags: number theory, primes



Find all positive integers $n$ such that $n=q(q^2-q-1)=r(2r+1)$ for some primes $q$ and $r$. B.Gilevich