MathLabs

Problem 2

Determine all positive integers n for which (n^2+1)/(floor(sqrt(n))^2+2) is an integer. Here floor(r) denotes the greatest integer less than or equal to r.
Step 2 of 6: Reduce the numerator modulo the denominator
n2+1=(m2+a)2+1≡(a−2)2+1(modm2+2).n^2+1=(m^2+a)^2+1\equiv(a-2)^2+1\pmod{m^2+2}.
Detailed analysis

Modulo m^2+2 we have m^2≡−2. Substituting this into (m^2+a)^2+1 yields the displayed remainder. Thus the original integrality condition is equivalent to m^2+2 dividing (a−2)^2+1.