I have some unknown function which is giving me the following pattern when applied to the integers 0 to 195:
0 -> 0
1 -> 1
2 -> 10
3 -> 100
4 to 12 -> 101 to 109
13 -> 11
14 -> 110
15 to 23 -> 111 to 119
24 -> 12
25 -> 120
26 to 34 -> 121 to 129
...
Because it can't go above 195, the sequence eventually does this:
something -> 19
something + 1 -> 190
191-195 as normal
2
20
21 to 29 as normal
3
30
31 to 39 as normal
etc, until all 195 numbers are counted. Both the left-hand side and right-hand side will eventually have a single copy of the integers from 0 to 195.
I can recognize the pattern going on, but I can't seem to write it in a concise mathematical way.
Here is a recipe for deriving the next element $x_{n+1}$ from the $n$th element $x_n$:
Not very elegant, I'm afraid, and if you want $x_n$ directly in terms of $n$, it would get even messier. But perhaps there's a pattern that I'm not seeing. (Where does $195$ come from, by the way?)