Write a formula $\phi(x)$ in arithmetic language that claims, that $x$ is a factorial for any number. It means that for every valuation $v:X \to \mathbb{N} \ \ (\mathbb{A}, v) \models \phi $ iff $v(x)$ is $n!$ for any $n$. $\mathbb{A}$ is a standard arithmetic model.
I know that I should use Godel's beta function but I don't know how to start. Please help me.
$$\exists t \exists p \exists n \chi[t, p, 0, 1] \wedge \chi[t, p, n, x] \wedge (\forall i 0 < i < n \implies (\exists a \chi [t, p, i-1, a] \wedge \chi[t, p, i, i \cdot a]))$$
Is it sufficient? It seems that it defines a beta function, therefore it defines a sequence, therefore it sequence a function: $f: \mathbb{N} \to \mathbb{N} $ and especially defined funcion is a factorial. Am I right?