Let $n = (p^2 +2)^2 -9(p^2 -7)$ where $p$ is a prime number. Determine the smallest value of the sum of the digits of $n$ and for what prime number $p$ is obtained.
Source: 2010 Cuba MO 2.2
Tags: number theory, sum of digits
Let $n = (p^2 +2)^2 -9(p^2 -7)$ where $p$ is a prime number. Determine the smallest value of the sum of the digits of $n$ and for what prime number $p$ is obtained.