First, if we let m = 2n² - n + 2, then we get:
m² = (2n² - n + 2)² = (2n² - n + 2) * (2n² - n + 2)
= 4n⁴ - 2n³ + 4n² - 2n³ + n² - 2n + 4n² - 2n + 4
= 4n⁴ - 4n³ + 9n² - 4n + 4
= (4n⁴ - 4n³ + 12n² + 20) + (-3n² - 4n - 16)
= 4 * (n⁴ - n³ + 3n² + 5) - (3n² + 4n + 16)
= 4*f(n) - g(n), so 4*f(n) = m² + g(n),
where g(n) = 3n² + 4n + 16, which is > 0 for all n >= 1,
so 4*f(n) is always greater than (>) the perfect square m².
(m+1)² = m² + 2m + 1 = (4n⁴ - 4n³ + 9n² - 4n + 4) + 2(2n² - n + 2) + 1
= 4n⁴ - 4n³ + 9n² - 4n + 4 + 4n² - 2n + 4 + 1 = 4n⁴ - 4n³ + 13n² - 6n + 9
= (4n⁴ - 4n³ + 12n² + 20) + (n² - 6n - 11)
= 4 * (n⁴ - n³ + 3n² + 5) + (n² - 6n - 11)
= 4*f(n) + h(n), so 4*f(n) = (m+1)² - h(n), where
h(n) = n² - 6n - 11 = (n² - 6n - 16) + 5 = (n-8) * (n+2) + 5,
which is >= 5, which > 0, for all n >= 8, so 4*f(n) is
less than (<) the perfect square (m+1)² for all n >= 8.
Therefore, 4*f(n) is never a perfect square for any and all n >= 8,
and it follows that f(n) is also never a perfect square for all n >= 8,
but we still need to check n = 1, 2, 3, 4, 5, 6, and 7:
For n = 1, we get f(1) = 1⁴ - 1³ + 3*1² + 5 = 1 - 1 + 3 + 5 = 8,
which is not a perfect square, so n = 1 is not a solution.
For n = 2, we get f(2) = 2⁴ - 2³ + 3*2² + 5 = 16 - 8 + 12 + 5 = 25,
which is a perfect square, so n = 2 is a solution.
For n = 3, we get f(3) = 3⁴ - 3³ + 3*3² + 5 = 81 - 27 + 27 + 5 = 86,
which is not a perfect square, so n = 3 is not a solution.
For n = 4, we get f(4) = 4⁴ - 4³ + 3*4² + 5 = 256 - 64 + 48 + 5 = 245,
which is not a perfect square, so n = 4 is not a solution.
For n = 5, we get f(5) = 5⁴ - 5³ + 3*5² + 5 = 625 - 125 + 75 + 5 = 580,
which is not a perfect square, so n = 5 is not a solution.
For n = 6, we get f(6) = 6⁴ - 6³ + 3*6² + 5 = 1296- 216 + 108 + 5 = 1193,
which is not a perfect square, so n = 6 is not a solution.
For n = 7, we get f(7) = 7⁴ - 7³ + 3*7² + 5 = 2401 - 343 + 147 + 5 = 2210,
which is not a perfect square, so n = 7 is not a solution.
Therefore, finally we can conclude that n = 2 is the only solution,
that is, it is the only n for which f(n) is a perfect square.