Notation Issue
In Combinatorial Game Theory, integers like $4$ each denote a particular game or game value, like $\{3\mid\,\}$ (note that we don't write $\varnothing$ in this notation).
As nombre pointed out in the comments, the written equations like "$n=\{\frac{n}{2}\mid\varnothing\}$" are rarely/never true under standard notation for combinatorial games.
If you don't intend to be referencing the standard meanings of $n$, $3n+1$, and $\frac{n}{2}$ in this notation, you should either have a gigantic disclaimer that the usual notation does not apply, or just use something else for the games you would like to describe.
I'll use $g(n)$ where you have $n$, etc. So we have $g(1)=\{\,\mid\,\}$, $g(n)=\{g(n/2)\mid\,\}$ for even $n$, and $g(n)=\{\,\mid g(3n+1)\}$ for odd $n>1$. Technically, this is only a valid definition for all $n$ if the Collatz conjecture is true.
Example Numeric Values
Let's start building a table and see if we see any patterns. $g(1)=\{\,\mid\,\}=0$. $g(2)=\{g(1)\mid\,\}=\{0\mid\,\}=1$. $$\begin{align}g(3)&=\{\,\mid g(10)\}\\&=\{\,\mid \{g(5)\mid\,\}\}\\&=\{\,\mid \{\{\,\mid g(16)\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{g(8)\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{g(4)\mid\,\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\{g(2)\mid\,\}\mid\,\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\{1\mid\,\}\mid\,\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{2\mid\,\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{3\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid 4\}\mid\,\}\}\\&=\{\,\mid \{0\mid\,\}\}\\&=\{\,\mid 1\}\\&=0\end{align}$$ $g(4)=2$, $g(5)=0$, $g(6)=\{g(3)\mid\,\}=\{0\mid\,\}=1$.
$$\begin{align}g(7)&=\{\,\mid g(22)\}\\&=\{\,\mid \{g(11)\mid\,\}\}\\&=\{\,\mid \{\{\,\mid g(34)\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{g(17)\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid g(52)\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{g(26)\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{g(13)\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid g(40)\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid \{g(20)\mid\,\}\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid \{\{g(10)\mid\,\}\mid\,\}\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid \{\{1\mid\,\}\mid\,\}\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid \{2\mid\,\}\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{\{\,\mid 3\}\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{\{0\mid\,\}\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid \{1\mid\,\}\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{\{\,\mid 2\}\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid \{0\mid\,\}\}\mid\,\}\}\\&=\{\,\mid \{\{\,\mid 1\}\mid\,\}\}\\&=\{\,\mid \{0\mid\,\}\}\\&=\{\,\mid 1\}\\&=0\end{align}$$
Claim
In general, the numeric value of $g(n)$ appears to be the highest exponent $m$ such that $2^m$ divides $n$.
Proof
Let's assume, for induction, that the claim is true of all the values of $g$ that arise during the calculation of $g(n)$. Note that $g(1)=0$. If $n$ is even, then $g(n)=\{g(n/2)\mid\,\}=g(n/2)+1$, which matches the highest power of $2$ for $n$. If $n$ is odd and greater than $1$, then $g(n)=\{\,\mid g(3n+1)\}$. Since $3n+1$ is even, $g(3n+1)\ge1$, so that $g(n)=0$, as desired.