Let $f$ be the arithmetic function $f(x)=\left|a-\frac{x!}{a}\right|$ where $a$ is the divisor of $x!$ which is the closest to $\sqrt{x!}$. For example, $f(5)=2$ since the divisors of $5!=120$ are: ${1,2,3,...,10,12,...,40,60,120}$ and the two closest divisors for $\sqrt{5!}$ are $10$ and $12$, and $|10-\frac{5!}{10}|=|12-\frac{5!}{12}|=2$. Here is a table for $f(x)$ for the first $140$ terms: https://oeis.org/A061057/b061057.txt.
I proved that $f(x^2)=xf(x^2-1)$ and since if $n>1$ then $n!$ can't be a perfect square, thus if $x>1$ then $f(x)>0$, therefore $f(x^2)≥x$, this implies that if $a>2b$ then $(a^2)!+b^2≠c^2$. If $b=1$ then in Brocard's problem, it proves that $4$ is the only solution square solution for $a$.
Brocard's problem. Does $n!+1 = m^2$ have integer solutions other than $n = 4, 5, 7$?
And I want to note that it seems $f(x)$ is asymptotic to $\left(\frac{x}{F}\right)!^2$ where $F\approx3.36$ is a constant (close to the Fibonacci reciprocal constant).
Does this property ($f(x^2)=xf(x^2-1)$) implies any other equality or inequality?
Is this a new discovery or a known thing?
Can it somehow help in the Brocard's problem?