What's that number in Shortlex?
JavaScript (ES6) 42 74
n=&gt;(n-~(n+'').replace(/./g,8)+'').slice(1)

Test in FireFox console
;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x =&gt; console.log(x +&quot; -&gt; '&quot; + S(x) + &quot;'&quot;))

Output
0 -&gt; ''
1 -&gt; '0'
10 -&gt; '9'
11 -&gt; '00'
42 -&gt; '31'
100 -&gt; '89'
800 -&gt; '689'
1060 -&gt; '949'
10270 -&gt; '9159'
100501 -&gt; '89390'

How did I think of this?
Given a fixed number of digits, the output sequence is simply ascending, so there is a fixed delta between input and output. Have a look:
  1..10 -&gt; 0..9 (delta -1)
 11..110 -&gt; 00..99 (delta -11)
111..1110 -&gt; 000..999 (delta -111) mmm there's a pattern here...

But the leading 0s are difficult to manage, so I have a standard trick, add a first digit and work modulo (that is, cut the first digit in output). Then -1-&gt; +9, -11 -&gt; +89, -111 -&gt; +889 and so on. 
Last step: I don't care what the first digit is, so there is no need to check if the iinput number is &lt; or &gt; than 111... (honestly I found this by trial and error)
Test


var F=
n=&gt;(n-~(n+'').replace(/./g,8)+'').slice(1)

function update()
{
  var i=+I.value
  O.textContent = F(i)
}


update()
&lt;input id=I value=99 type=number oninput='update()'&gt;&lt;pre id=O&gt;&lt;/pre&gt;