I want to find out the function to generate the sequence with the following pattern.

```
1 2 3 1 1 2 2 3 3 1 1 1 1 2 2 2 2 3 3 3 3 ....

```

Where the lower bound number is 1 upper number bound number is 3. Each time numbers start from 1 and each number repeats `2 ^ n` times, with n starting with 0.