Construct the natural numbers with sets This construction is a way of representing the Natural Numbers.

In this representation, 0 is defined as the empty set and for all other numbers, n is the union of {0} and {n-1}.

For example to construct 3 we can follow the algorithm: 

3 =
{ø, 2} =
{ø, {ø, 1}} =
{ø, {ø, {ø}}}


Task

As you may have guessed your task is to take in a natural number (including zero) and output its construction.

You may output as a either a string or as a set object if your language of choice supports such objects.

If you choose to output as a string you should represent a set with curly braces ({}).  You may optionally represent the empty set as ø (otherwise it should be a set with no entries {}).  You may also choose to add commas and whitespace between and after entries in the set.

Order is not important, however you may not have any repeated elements in the sets you output (e.g. {ø,ø})

This is code-golf so the goal is to have the fewest bytes

Test cases

Here are some test cases with some example outputs.

0 -&gt; {}
1 -&gt; {{}}
2 -&gt; {{}{{}}}
3 -&gt; {{}{{}{{}}}}
4 -&gt; {{}{{}{{}{{}}}}}
Python, 28 bytes



lambda x:"{{}"*x+x*"}"or"{}"


Try it online!

This is a pretty bland solution to the problem.  For numbers greater than zero you can get the representation with the string formula "{{}"*x+"}"*x.  However this doesn't work for zero where this is the empty string.  We can use this fact to short circuit an or to return the empty set.

I wanted to use python's builtin set objects to solve this problem but unfortunately:

TypeError: unhashable type: 'set'


You cannot put sets inside of sets in python.