User blog:Superiumentarius/Space delimiter sequence

The space delimiter sequence (SDS) is a notation in the form of $$ a_0|a_1|...|a_{m-1}|a_m $$

The rules are as follows:

Rules $$ \#$$ denotes any sequence; can be empty

p = last entry $$a_k$$ such that $$a_{k-1} >= a_k$$ and $$1 < k < m $$; does not exist if $$a_0|...|a_{m-1}$$ are sorted in strictly ascending order


 * 1) $$a_0|a_1 = a_0 + a_1$$
 * 2)  $$\#_1|0|\#_2 = \#_1|\#_2$$ (remove any zeroes)
 * 3) $$\#_1|p|\#_2|a_m = \#_1|(\#_1|p-1|\#_2|a_m)|\#_2|a_m$$ (if p exists, replace it with the whole array with p decremented by 1)
 * 4) $$a_0|a_1|\ldots|a_m = a_{m-1}|a_{m-2}|\ldots|a_1|a_0|(a_m-1)$$ (if p doesn't exists, reverse the order of the first m-1 entries, and decrement the last entry by 1)

Example

Some Values

2|1|1 = 5

2|2|2 = 40

3|3|2 = 341

1|1|1|1 = 656

5|5|2 = 55987

8|8|2 = 435848050

9|8|2 = 1111111111

10|8|2 = 18446744072008326780