A positive integer is called a $\textit{prime}$ if it is greater than $1$ and cannot be written as the product of two smaller positive integers. A $\textit{primality test}$ is an algorithm for determining whether an input number is a prime. For example, the Miller-Rabin primality test is a probabilistic primality test. This problem is precisely the one about the primality test.
Let's define the function $f(x)$ as the smallest prime which is strictly larger than $x$. For example, $f(1)=2$, $f(2)=3$, and $f(3)=f(4)=5$. And we use $\lfloor x \rfloor$ to indicate the largest integer that does not exceed $x$.
Now given $x$, please determine whether $g(x)$ is a prime.
$$g(x)=\left\lfloor\dfrac{f(x)+f(f(x))}{2}\right\rfloor$$