Comments

Given that \(2n+1=x^2, 3n+1=y^2\), If we add the two equations we get: \(5n+2=x^2+y^2\Rightarrow x^2+y^2\equiv 2\pmod 5\), since the quadratic residues of mod \(5\) are\(0,1,4\), we can check that only \(x^2\equiv y^2\equiv 1\) works, therefore \(2n\equiv 1-1\equiv 0\pmod 5\Rightarrow 5\mid n\)

The same analysis can be done for \(8\), but we will multiply the second equation by \(2\) first and then add: \(8n+3=x^2+2y^2\Rightarrow x^2+2y^2\equiv 3\pmod 8\), since the quadratic residues of mod \(8\) are \(0,1,4\), we can check that only \(x^2\equiv y^2\equiv 1\) works again, which means \(3n\equiv 1-1\equiv 0\pmod 8\Rightarrow 8\mod n\) and we are done.