How to write numbers in the language of first-order set theory. I saw this Numberphile video (link at bottom), and at around 10:10 they talk about writing numbers in the language of first-order set theory. For example, to write $0$, it showed the empty set:
$$\exists x_1\neg\exists x_2(x_2\in x_1)$$
And to write $1$, it said: $$\exists x_1\forall x_2(x_2\in x_1\leftrightarrow(\neg\exists x_3(x_3\in x_2)\vee\forall x_3(x_3\in x_2\leftrightarrow\neg\exists x_4(x_4\in x_3))))$$

Edit: An answer has corrected this and showed that the above formula is for $2$, not $1$. I have left the above as this is what the video showed.

The video then alluded to writing other numbers, saying that it takes less symbols as the numbers get larger.
This made me curious and I wanted to find out more about this topic.
I have done research and tried to find how to write other numbers in the language of first-order set theory, but I haven't been able to find anything.

Question
Does anyone know any resources/websites with information on how to write numbers in the language of first-order set theory? I have searched the internet many times but I haven't been able to find this.

Or is it just that there are no websites about this because there is no use for them and nobody really cares about them?
Thanks.
Numberphile video-The Daddy of Big Numbers (Rayo's Number)-Numberphile https://youtu.be/X3l0fPHZja8
 A: The logical formulas you have written describe the Von Neumann Ordinals for 0 and 1. This is one particular encoding of numbers in terms of sets, which can be easily turned into numbers in terms of logical formulas by writing a sentence saying explicitly what is in that set (this describes the set uniquely by extensionality). 
For instance, to say $0 = \emptyset$, which it is, we would instead say $\forall x . x \not \in 0$. That formula forces $0 = \emptyset$. The formula you've written says "the number $0$ exists".
Similarly, $1 = \{ \emptyset \}$. So we can express in the language of logic by writing
$\forall x . x \in 1 \leftrightarrow x = 0$. If we want to be purists, and avoid using the defined symbol $0$: 
$$ \forall x . x \in 1 \leftrightarrow (\forall y . y \not \in x)$$
The second formula you've written is actually the number $2$. Well, it's the formula saying "the number $2$ (which it is calling $x_1$) exists", but they're very similar ideas. 
If you want a reference for this material, any decent book on set theory will do. In fact, just knowing that these are called "von Neumann Ordinals" will help tremendously. Good luck!
Edit:
The sentence you have written is quite long, so I'll color code it for ease of reference. Each part of this says something that points towards "$x_1 = 2$". Let's break it down:
$$
\exists x_1 \forall x_2 
(
  x_2 \in x_1 \leftrightarrow
  (
    \color{blue}{\lnot \exists x_3 (x_3 \in x_2)}
    \lor
    \color{green}{\forall x_3 (x_3 \in x_2 \leftrightarrow}
    \color{red}{\lnot \exists x_4 (x_4 \in x_3)}\color{green}{)}
  )
)
$$
This says: 


*

*there exists a set $x_1$ (which we will soon see to be $2$) such that

*$x_2 \in x_1$ iff some condition holds on $x_2$. 


*

*remember, we want this condition to be "$x_2 = 0 \lor x_2 = 1$"


*the blue part of this condition says $x_2 = \emptyset$, so $x_2 = 0$

*the green part says the only thing in $x_2$ has a unique element, colored red


*

*notice the red part says "$x_3 = \emptyset$", or, $x_3 = 0$


*so the green part says $x_2 = \{ \emptyset \}$, equivalently, $x_2 = 1$

*so the blue and green parts together say $x_2 = 0 \lor x_2 = 1$

*this is exactly what we wanted, and $x_1 = \{0, 1\} = 2$

I hope this helps ^_^
