We have 18(n2 + 3) = (n + 3)3 − (n − 3)3.
By Fermat's Last Theorem, xm + ym = zm has no non-zero integer solutions for x, y and z, when m > 2. Here we need the result only for the case m = 3, which was first proved by Euler, with a gap filled by Legendre.
Hence the only values of n for which 18(n2 + 3) is a perfect cube, are where n + 3 = 0 or n − 3 = 0; that is, n = ±3.
Source: Original