I am a hobby computer scientist and searching for an algorithm to construct a set of **n** numbers (integers) with certain properties.

**Property 1 / Step 1**

All pairwise differences of the elements should be **unique**. From what I read, I think this is called 'difference set'.

**Property 2 / Step 2**

Having constructed all differences in step 1, we build the differences of the new set again. The resulting elements should also be as unique as possible. Meaning equal differences should be minimal.

**What I have so far**

It is clear to me, that "step 1" implies, that the largest number in the set is of order n². I was hoping that after "step 2" the largest number would not increase too much (like n² * log(n)), but my simulations suggest an order of n³.

**Example 1**

The set {0,1,4,9} fullfills poperty 1, but it fails on property 2.

After steps 1 we have the difference set {0, 1, 3, 4, 5, 8, 9}. If arranged in a table one can write:

```
0 1 4 9
0 3 8
0 5
0
```

It is clear, that 9-4 and 8-3 have the same difference. Due to the construction some differences cannot be prevented.

But 5-1 = 4-0 is a difference which should not happen in step 2.

**Example 2**

The set {0,1,4,13} fullfills poperty 1 and property 2.

```
0 1 4 13
0 3 12
0 9
0
```

The only equal differences occur, when four choosen numbers form a "rectangle", like 13-4 = 9 -0

I would really appreciate any help!

theirdifferences. Thus, the best you can hope for is the largest integer to have magnitude $O(n^4)$. $\endgroup$