Primitive sequence to ordinal in four lines Javascript
Primitive sequence:
Ordinal:

Primitive sequence | Pair sequence