# Sort a list of Numbers as letters [closed]

So, you have a random list (random meaning it doesn't matter what order it is in) of numbers with a length of n, where n is a positive integer smaller than 1000 and larger than 1.

The random list must contain every number from 0 to (n - 1). Eg: [0, 3, 2, 5, 1, 4] (where n is 6).

Note: If there is more than one digit you do not translate like English - 11 is not "eleven", it is "one one".

Your task is to sort these numbers, but there are some difference to normal sorting:

1. You have to sort them as if they were the numbers expressed as words, in alphabetical order, but you cannot replace the numbers with letters [1]

2. At any given time, the list must contain exactly the same numbers in the exact quantities as the original list, you cannot add or remove any

Test Cases

n = 6
[0, 3, 2, 5, 1, 4] = [5, 4, 1, 3, 2, 0] (sorted like this but not this - ["five", "four", "one", "three", "two", "zero"])
n = 8
[0, 3, 7, 2, 5, 1, 6, 4] = [5, 4, 1, 7, 6, 3, 2, 0] (sorted like this but not this - ["five", "four", "one", "seven", "six", "three", "two", "zero"])


This is code-golf, so the smallest answer in bytes wins.

[1]: You may create another list to do the sorting, but the original list must have the same contents at all times

• You need to define exactly how numbers translate to words. For example: is 101 one hundred and one, one hundred one, one zero one ... or ... what? – Shaggy Mar 16 '19 at 21:48
• Can we internally convert numbers to words, sort, then convert them back? – Benjamin Urquhart Mar 16 '19 at 21:50
• Both (1) and (2) are unobservable. – Jonathan Allan Mar 16 '19 at 21:57
• @BenjaminUrquhart, as Jonathan mentioned, that's an unobservable requirement. – Shaggy Mar 16 '19 at 22:03
• Also, I don't really see the point of the input apart from the length. It doesn't matter what permutation the input is, if it is always the range from 1 to n, since the output is going to be sorted anyway – Jo King Mar 17 '19 at 12:04

#~SortBy~IntegerName&

• While I do not agree with the unobservable requirement it is nonetheless there... "you cannot replace the numbers with letters" - pretty sure that is what IntegerName will do. – Jonathan Allan Mar 16 '19 at 21:59