5 Test snippet

# JavaScript (ES6) 444274

S=n=>n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

0 -> ''
1 -> '0'
10 -> '9'
11 -> '00'
42 -> '31'
100 -> '89'
800 -> '689'
1060 -> '949'
10270 -> '9159'
100501 -> '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 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

Test

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

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

update()
<input id=I value=99 type=number oninput='update()'><pre id=O></pre>

# JavaScript (ES6) 4474

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

# JavaScript (ES6) 4274

n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

0 -> ''
1 -> '0'
10 -> '9'
11 -> '00'
42 -> '31'
100 -> '89'
800 -> '689'
1060 -> '949'
10270 -> '9159'
100501 -> '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 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

Test

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

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

update()
<input id=I value=99 type=number oninput='update()'><pre id=O></pre>

4 deleted 4 characters in body

# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. But Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. But Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

3 added 516 characters in body

# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. But Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


# JavaScript (ES6) 44 74

S=n=>(n-~(n+'').replace(/./g,8)+'').slice(1)


Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))


Output

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


How did I think of this?

Given a fixed number of digits, the output sequence is simply ascending, so there a fixed delta between input and output. But Have a look:

  1..10 -> 0..9 (delta -1)
11..110 -> 00..99 (delta -11)
111..1110 -> 000..999 (delta -111) mmm there's 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-> +9, -11 -> +89, -111 -> +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 < or > than 111... (honestly I found this by trial and error)

2 deleted 77 characters in body
1