EDIT: The following will work for a vector containing only single-digit elements. You can modify the algorithm to work for any number of digits yourself.
You need an algorithm that describes how to go from 1->12 and 12->123 and so on.
The pattern is that each previous number is multiplied by 10, and the current value is then added to it. The value we start with is actually 0.
For example:
To get to 1: 0*10 +1
To go from 1 to 12: 1*10 + 2
To go from 12 to 123: 12*10 + 3
and so on...