Post History
Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are not the conventional ordinal names. Input A positive integer from the te...
#4: Post edited
- Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral).
- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Conversion
- To convert a number to its awkward ordinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional ordinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward ordinal, which is the awkward cardinal ten times less stripped of spaces and followed by "tieth".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional ordinal.
- To convert a number to its awkward cardinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional cardinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward cardinal, which is the awkward cardinal 10 times less stripped of spaces and followed by "ty".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional cardinal.
- ### Example code
- Assuming you already had functions for the conventional ordinals and cardinals less than 20, and a `spaceless` function that returns its input with all spaces removed, the following Python code would give the results as described above (note that this is for ease of explanation - you cannot assume existence of non-existent functions in your answer):
- ```python
- def awkward_ordinal(n):
- if n<20:
- return conventional_ordinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"tieth"
- return awkward_cardinal(n-n%20)+" "+conventional_ordinal(n%20)
- def awkward_cardinal(n):
- if n<20:
- return conventional_cardinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"ty"
- return awkward_cardinal(n-n%20)+" "+conventional_cardinal(n%20)
- ```
- So 40 becomes the ordinal `fortieth` but 46 becomes the cardinal `forty` plus the ordinal `sixth` to give `forty sixth`.
Notice that the algorithm as described would give `fourtieth` rather than `fortieth` and `fourty sixth` rather than `forty sixth`, so passing the test cases will require being aware of such exceptions to the general rule. These are described below.- ### Cardinals and ordinals 1 to 19
- The numbers up to 19 become cardinals and ordinals in the conventional way, giving cardinals one to nineteen and ordinals first to nineteenth (with the conventional exceptions of first, second, third, fifth, eighth, ninth, twelfth, fifteenth, and eighteenth instead of oneth, twoth, threeth, fiveth, eightth, nineth, twelveth, fiveteenth, and eightteenth).
- ### Larger cardinals
- A number that is a multiple of 20 becomes a cardinal by dividing it by 10 and then adding "ty" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twenty | twoty
- 40 | forty | fourty
- 80 | eighty | eightty
- 120 | twelfty | twelvety
- ### Larger ordinals
- A number that is a multiple of 20 becomes an ordinal by dividing it by 10 and then adding "tieth" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twentieth | twotieth
- 40 | fortieth | fourtieth
- 80 | eightieth | eighttieth
- 120 | twelftieth | twelvetieth
- ## Conversion examples
- ### No exceptions
- - 66 = 60 + 6 = 6*10 + 6
- - Ordinal is (6)ty (6)th giving `sixty sixth`.
- ### Exceptions
- - 48 = 40 + 8 = 4*10 + 8
- - Ordinal would be (4)ty (8)th giving `fourty eightth` but exceptions make it `forty eighth` instead.
- ### Remainder mod 20 larger than 10
- - 74 = 60 + 14 = 6*10 + 14
- - Ordinal is (6)ty (14)th giving `sixty fourteenth`.
- ### No remainder mod 20
- - 60 = 60 + 0 = 6*10 + 0
- - Ordinal is (6)tieth giving `sixtieth`.
- ### Splitting twice
- - 474 = 460 + 14 = 46*10 + 14
- - Ordinal is (46)ty (14)th but first 46 needs to be split (because it is more than 19).
- - 46 = 40 + 6 = 4*10 + 6
- - Cardinal would be (4)ty 6 giving `fourty six` but exceptions make it `forty six` instead. Spaces will be omitted before combining with `ty`.
- - Ordinal is (`fortysix`)ty (14)th giving `fortysixty fourteenth`.
- ### Splitting four times
- - 37381 = 37380 + 1 = 3738*10 + 1
- - Ordinal is (3738)ty (1)th but first 3738 needs to be split.
- - 3738 = 3720 + 18 = 372*10 + 18
- - Cardinal is (372)ty 18 but first 372 needs to be split.
- - 372 = 360 + 12 = 36*10 + 12
- - Cardinal is (36)ty 12 but first 36 needs to be split.
- - 36 = 20 + 16 = 2*10 + 16
- - Cardinal is (2)ty 16 giving `twoty sixteen` but exceptions make it `twenty sixteen`.
- - Cardinal is (`twentysixteen`)ty 12 giving `twentysixteenty twelve`.
- - Cardinal is (`twentysixteentytwelve`)ty 18 giving `twentysixteentytwelvety eighteen` but exceptions make it `twentysixteentytwelfty eighteen`.
- - Ordinal is (`twentysixteentytwelftyeighteen`)ty (1)th giving `twentysixteentytwelftyeighteenty oneth` but exceptions make it `twentysixteentytwelftyeighteenty first`.
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
- Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral).
- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Conversion
- To convert a number to its awkward ordinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional ordinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward ordinal, which is the awkward cardinal ten times less stripped of spaces and followed by "tieth".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional ordinal.
- To convert a number to its awkward cardinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional cardinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward cardinal, which is the awkward cardinal 10 times less stripped of spaces and followed by "ty".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional cardinal.
- ### Example code
- Assuming you already had functions for the conventional ordinals and cardinals less than 20, and a `spaceless` function that returns its input with all spaces removed, the following Python code would give the results as described above (note that this is for ease of explanation - you cannot assume existence of non-existent functions in your answer):
- ```python
- def awkward_ordinal(n):
- if n<20:
- return conventional_ordinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"tieth"
- return awkward_cardinal(n-n%20)+" "+conventional_ordinal(n%20)
- def awkward_cardinal(n):
- if n<20:
- return conventional_cardinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"ty"
- return awkward_cardinal(n-n%20)+" "+conventional_cardinal(n%20)
- ```
- So 40 becomes the ordinal `fortieth` but 46 becomes the cardinal `forty` plus the ordinal `sixth` to give `forty sixth`.
- Notice that the algorithm as described would give `fourtieth` rather than `fortieth` and `fourty sixth` rather than `forty sixth`. Passing the test cases will require being aware of such exceptions to the general rule. These are described below.
- ### Cardinals and ordinals 1 to 19
- The numbers up to 19 become cardinals and ordinals in the conventional way, giving cardinals one to nineteen and ordinals first to nineteenth (with the conventional exceptions of first, second, third, fifth, eighth, ninth, twelfth, fifteenth, and eighteenth instead of oneth, twoth, threeth, fiveth, eightth, nineth, twelveth, fiveteenth, and eightteenth).
- ### Larger cardinals
- A number that is a multiple of 20 becomes a cardinal by dividing it by 10 and then adding "ty" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twenty | twoty
- 40 | forty | fourty
- 80 | eighty | eightty
- 120 | twelfty | twelvety
- ### Larger ordinals
- A number that is a multiple of 20 becomes an ordinal by dividing it by 10 and then adding "tieth" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twentieth | twotieth
- 40 | fortieth | fourtieth
- 80 | eightieth | eighttieth
- 120 | twelftieth | twelvetieth
- ## Conversion examples
- ### No exceptions
- - 66 = 60 + 6 = 6*10 + 6
- - Ordinal is (6)ty (6)th giving `sixty sixth`.
- ### Exceptions
- - 48 = 40 + 8 = 4*10 + 8
- - Ordinal would be (4)ty (8)th giving `fourty eightth` but exceptions make it `forty eighth` instead.
- ### Remainder mod 20 larger than 10
- - 74 = 60 + 14 = 6*10 + 14
- - Ordinal is (6)ty (14)th giving `sixty fourteenth`.
- ### No remainder mod 20
- - 60 = 60 + 0 = 6*10 + 0
- - Ordinal is (6)tieth giving `sixtieth`.
- ### Splitting twice
- - 474 = 460 + 14 = 46*10 + 14
- - Ordinal is (46)ty (14)th but first 46 needs to be split (because it is more than 19).
- - 46 = 40 + 6 = 4*10 + 6
- - Cardinal would be (4)ty 6 giving `fourty six` but exceptions make it `forty six` instead. Spaces will be omitted before combining with `ty`.
- - Ordinal is (`fortysix`)ty (14)th giving `fortysixty fourteenth`.
- ### Splitting four times
- - 37381 = 37380 + 1 = 3738*10 + 1
- - Ordinal is (3738)ty (1)th but first 3738 needs to be split.
- - 3738 = 3720 + 18 = 372*10 + 18
- - Cardinal is (372)ty 18 but first 372 needs to be split.
- - 372 = 360 + 12 = 36*10 + 12
- - Cardinal is (36)ty 12 but first 36 needs to be split.
- - 36 = 20 + 16 = 2*10 + 16
- - Cardinal is (2)ty 16 giving `twoty sixteen` but exceptions make it `twenty sixteen`.
- - Cardinal is (`twentysixteen`)ty 12 giving `twentysixteenty twelve`.
- - Cardinal is (`twentysixteentytwelve`)ty 18 giving `twentysixteentytwelvety eighteen` but exceptions make it `twentysixteentytwelfty eighteen`.
- - Ordinal is (`twentysixteentytwelftyeighteen`)ty (1)th giving `twentysixteentytwelftyeighteenty oneth` but exceptions make it `twentysixteentytwelftyeighteenty first`.
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#3: Post edited
- Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral).
- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
- Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral).
- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Conversion
- To convert a number to its awkward ordinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional ordinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward ordinal, which is the awkward cardinal ten times less stripped of spaces and followed by "tieth".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional ordinal.
- To convert a number to its awkward cardinal, split the number into a multiple of 20 and a remainder less than 20.
- - If the multiple of 20 is zero, the remainder becomes a conventional cardinal.
- - If the remainder is zero, the multiple of 20 becomes an awkward cardinal, which is the awkward cardinal 10 times less stripped of spaces and followed by "ty".
- - Otherwise, the multiple of 20 becomes an awkward cardinal followed by a space then the remainder as a conventional cardinal.
- ### Example code
- Assuming you already had functions for the conventional ordinals and cardinals less than 20, and a `spaceless` function that returns its input with all spaces removed, the following Python code would give the results as described above (note that this is for ease of explanation - you cannot assume existence of non-existent functions in your answer):
- ```python
- def awkward_ordinal(n):
- if n<20:
- return conventional_ordinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"tieth"
- return awkward_cardinal(n-n%20)+" "+conventional_ordinal(n%20)
- def awkward_cardinal(n):
- if n<20:
- return conventional_cardinal(n)
- if n%20==0:
- return spaceless(awkward_cardinal(n/10))+"ty"
- return awkward_cardinal(n-n%20)+" "+conventional_cardinal(n%20)
- ```
- So 40 becomes the ordinal `fortieth` but 46 becomes the cardinal `forty` plus the ordinal `sixth` to give `forty sixth`.
- Notice that the algorithm as described would give `fourtieth` rather than `fortieth` and `fourty sixth` rather than `forty sixth`, so passing the test cases will require being aware of such exceptions to the general rule. These are described below.
- ### Cardinals and ordinals 1 to 19
- The numbers up to 19 become cardinals and ordinals in the conventional way, giving cardinals one to nineteen and ordinals first to nineteenth (with the conventional exceptions of first, second, third, fifth, eighth, ninth, twelfth, fifteenth, and eighteenth instead of oneth, twoth, threeth, fiveth, eightth, nineth, twelveth, fiveteenth, and eightteenth).
- ### Larger cardinals
- A number that is a multiple of 20 becomes a cardinal by dividing it by 10 and then adding "ty" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twenty | twoty
- 40 | forty | fourty
- 80 | eighty | eightty
- 120 | twelfty | twelvety
- ### Larger ordinals
- A number that is a multiple of 20 becomes an ordinal by dividing it by 10 and then adding "tieth" to the cardinal form of that result, omitting any spaces, with the following exceptions:
- Number ending in | Becomes cardinal ending in | Instead of
- ---|---|---
- 20 | twentieth | twotieth
- 40 | fortieth | fourtieth
- 80 | eightieth | eighttieth
- 120 | twelftieth | twelvetieth
- ## Conversion examples
- ### No exceptions
- - 66 = 60 + 6 = 6*10 + 6
- - Ordinal is (6)ty (6)th giving `sixty sixth`.
- ### Exceptions
- - 48 = 40 + 8 = 4*10 + 8
- - Ordinal would be (4)ty (8)th giving `fourty eightth` but exceptions make it `forty eighth` instead.
- ### Remainder mod 20 larger than 10
- - 74 = 60 + 14 = 6*10 + 14
- - Ordinal is (6)ty (14)th giving `sixty fourteenth`.
- ### No remainder mod 20
- - 60 = 60 + 0 = 6*10 + 0
- - Ordinal is (6)tieth giving `sixtieth`.
- ### Splitting twice
- - 474 = 460 + 14 = 46*10 + 14
- - Ordinal is (46)ty (14)th but first 46 needs to be split (because it is more than 19).
- - 46 = 40 + 6 = 4*10 + 6
- - Cardinal would be (4)ty 6 giving `fourty six` but exceptions make it `forty six` instead. Spaces will be omitted before combining with `ty`.
- - Ordinal is (`fortysix`)ty (14)th giving `fortysixty fourteenth`.
- ### Splitting four times
- - 37381 = 37380 + 1 = 3738*10 + 1
- - Ordinal is (3738)ty (1)th but first 3738 needs to be split.
- - 3738 = 3720 + 18 = 372*10 + 18
- - Cardinal is (372)ty 18 but first 372 needs to be split.
- - 372 = 360 + 12 = 36*10 + 12
- - Cardinal is (36)ty 12 but first 36 needs to be split.
- - 36 = 20 + 16 = 2*10 + 16
- - Cardinal is (2)ty 16 giving `twoty sixteen` but exceptions make it `twenty sixteen`.
- - Cardinal is (`twentysixteen`)ty 12 giving `twentysixteenty twelve`.
- - Cardinal is (`twentysixteentytwelve`)ty 18 giving `twentysixteentytwelvety eighteen` but exceptions make it `twentysixteentytwelfty eighteen`.
- - Ordinal is (`twentysixteentytwelftyeighteen`)ty (1)th giving `twentysixteentytwelftyeighteenty oneth` but exceptions make it `twentysixteentytwelftyeighteenty first`.
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#2: Post edited
Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral), although there is significant overlap.You are free to use any approach that happens to pass all the test cases.- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
## ExampleGiven input `224`:- The correct output is `twentytwenty fourth`.- It is incorrect to output `twenty twenty fourth` (due to the extra space).- It is incorrect to output `twentytwentyfourth` (due to the missing space).- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
- Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral).
- ## Input
- - A positive integer from the test cases.
- - You are not required to support any input not listed in the test cases.
- ## Output
- - The corresponding string from the test cases.
- - This must be in the exact format shown, including having spaces in and only in the specified places.
- ## Test cases
- Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces.
- There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs.
- ```text
- 1:first
- 2:second
- 3:third
- 4:fourth
- 5:fifth
- 6:sixth
- 7:seventh
- 8:eighth
- 9:ninth
- 10:tenth
- 11:eleventh
- 12:twelfth
- 13:thirteenth
- 14:fourteenth
- 15:fifteenth
- 16:sixteenth
- 17:seventeenth
- 18:eighteenth
- 19:nineteenth
- 20:twentieth
- 21:twenty first
- 22:twenty second
- 23:twenty third
- 24:twenty fourth
- 25:twenty fifth
- 26:twenty sixth
- 27:twenty seventh
- 28:twenty eighth
- 29:twenty ninth
- 30:twenty tenth
- 31:twenty eleventh
- 32:twenty twelfth
- 33:twenty thirteenth
- 34:twenty fourteenth
- 35:twenty fifteenth
- 36:twenty sixteenth
- 37:twenty seventeenth
- 38:twenty eighteenth
- 39:twenty nineteenth
- 40:fortieth
- 41:forty first
- 44:forty fourth
- 47:forty seventh
- 50:forty tenth
- 53:forty thirteenth
- 56:forty sixteenth
- 59:forty nineteenth
- 62:sixty second
- 65:sixty fifth
- 68:sixty eighth
- 71:sixty eleventh
- 74:sixty fourteenth
- 77:sixty seventeenth
- 80:eightieth
- 83:eighty third
- 86:eighty sixth
- 89:eighty ninth
- 92:eighty twelfth
- 95:eighty fifteenth
- 98:eighty eighteenth
- 105:tenty fifth
- 112:tenty twelfth
- 119:tenty nineteenth
- 126:twelfty sixth
- 133:twelfty thirteenth
- 140:fourteentieth
- 147:fourteenty seventh
- 154:fourteenty fourteenth
- 161:sixteenty first
- 168:sixteenty eighth
- 175:sixteenty fifteenth
- 182:eighteenty second
- 189:eighteenty ninth
- 196:eighteenty sixteenth
- 203:twentyty third
- 210:twentyty tenth
- 217:twentyty seventeenth
- 224:twentytwenty fourth
- 231:twentytwenty eleventh
- 250:twentyforty tenth
- 269:twentysixty ninth
- 288:twentyeighty eighth
- 307:twentytenty seventh
- 326:twentytwelfty sixth
- 345:twentyfourteenty fifth
- 364:twentysixteenty fourth
- 383:twentyeighteenty third
- 402:fortyty second
- 421:fortytwenty first
- 440:fortyfortieth
- 459:fortyforty nineteenth
- 478:fortysixty eighteenth
- 497:fortyeighty seventeenth
- 516:fortytenty sixteenth
- 535:fortytwelfty fifteenth
- 554:fortyfourteenty fourteenth
- 573:fortysixteenty thirteenth
- 592:fortyeighteenty twelfth
- 880:eightyeightieth
- 1283:twelftyeighty third
- 1400:fourteentytieth
- 1617:sixteentyty seventeenth
- 4360:fortytwentysixteentieth
- 4895:fortyeightyeighty fifteenth
- 6802:sixtyeightyty second
- 6837:sixtyeightytwenty seventeenth
- 7999:sixtyeighteentyeighteenty nineteenth
- 8320:eightytwentytwelftieth
- 8944:eightyeightyfourteenty fourth
- 9274:eightytwelftysixty fourteenth
- 9353:eightytwelftyfourteenty thirteenth
- 10008:tentytyty eighth
- 10045:tentytyforty fifth
- 10405:tentyfortyty fifth
- 10731:tentysixtytwelfty eleventh
- 10740:tentysixtyfourteentieth
- 11320:tentytwelftytwelftieth
- 13206:twelftytwelftyty sixth
- 13240:twelftytwelftyfortieth
- 13415:twelftyfourteentyty fifteenth
- 13471:twelftyfourteentysixty eleventh
- 14616:fourteentysixtyty sixteenth
- 15348:fourteentytwelftyfourteenty eighth
- 15560:fourteentyfourteentysixteentieth
- 16000:sixteentytytieth
- 17333:sixteentytwelftytwelfty thirteenth
- 18066:eighteentytysixty sixth
- 18263:eighteentytwentysixty third
- 18976:eighteentyeightysixteenty sixteenth
- 20017:twentytytyty seventeenth
- 20018:twentytytyty eighteenth
- 20260:twentytytwentysixtieth
- 20955:twentytyeightyfourteenty fifteenth
- 21445:twentytyfourteentyforty fifth
- 21553:twentytyfourteentyfourteenty thirteenth
- 21860:twentytyeighteentysixtieth
- 25188:twentyfortytentyeighteenty eighth
- 25529:twentyfortyfourteentytwelfty ninth
- 27360:twentysixtytwelftysixteentieth
- 27772:twentysixtysixteentysixteenty twelfth
- 28061:twentyeightytysixty first
- 28800:twentyeightyeightytieth
- 29220:twentyeightytwelftytwentieth
- 29740:twentyeightysixteentyfourteentieth
- 29950:twentyeightyeighteentyfourteenty tenth
- 30340:twentytentytwentyfourteentieth
- 31036:twentytentytentytwenty sixteenth
- 31600:twentytentysixteentytieth
- 33680:twentytwelftysixteentyeightieth
- 33719:twentytwelftysixteentytenty nineteenth
- 34019:twentyfourteentytyty nineteenth
- 34341:twentyfourteentytwentyfourteenty first
- 34526:twentyfourteentyfortytwelfty sixth
- 34713:twentyfourteentysixtytenty thirteenth
- 34715:twentyfourteentysixtytenty fifteenth
- 36650:twentysixteentysixtyforty tenth
- 37381:twentysixteentytwelftyeighteenty first
- 37780:twentysixteentysixteentyeighteentieth
- 38299:twentyeighteentytwentyeighty nineteenth
- 38982:twentyeighteentyeightyeighteenty second
- 40000:fortytytytieth
- 40907:fortytyeightytenty seventh
- 41849:fortytyeighteentyforty ninth
- 42000:fortytwentytytieth
- 42527:fortytwentyfortytwelfty seventh
- 43356:fortytwentytwelftyfourteenty sixteenth
- 43382:fortytwentytwelftyeighteenty second
- 44003:fortyfortytyty third
- 45187:fortyfortytentyeighteenty seventh
- 45208:fortyfortytwelftyty eighth
- 46220:fortysixtytwentytwentieth
- 46827:fortysixtyeightytwenty seventh
- 47436:fortysixtyfourteentytwenty sixteenth
- 47744:fortysixtysixteentyfourteenty fourth
- 47800:fortysixtyeighteentytieth
- 48198:fortyeightytyeighteenty eighteenth
- 52100:fortytwelftytytentieth
- 54000:fortyfourteentytytieth
- 57340:fortysixteentytwelftyfourteentieth
- 58010:fortyeighteentytyty tenth
- 58705:fortyeighteentysixtytenty fifth
- 59400:fortyeighteentyfourteentytieth
- 59713:fortyeighteentysixteentytenty thirteenth
- 60000:sixtytytytieth
- 60019:sixtytytyty nineteenth
- 60189:sixtytytyeighteenty ninth
- 60941:sixtytyeightyfourteenty first
- 62220:sixtytwentytwentytwentieth
- 62314:sixtytwentytwentytenty fourteenth
- 62754:sixtytwentysixtyfourteenty fourteenth
- 63540:sixtytwentyfourteentyfourteentieth
- 63965:sixtytwentyeighteentysixteenty fifth
- 64040:sixtyfortytyfortieth
- 64943:sixtyfortyeightyfourteenty third
- 65063:sixtyfortytentysixty third
- 65064:sixtyfortytentysixty fourth
- 65661:sixtyfortysixteentysixty first
- 65700:sixtyfortysixteentytentieth
- 65809:sixtyfortyeighteentyty ninth
- 65972:sixtyfortyeighteentysixteenty twelfth
- 66000:sixtysixtytytieth
- 69219:sixtyeightytwelftyty nineteenth
- 69589:sixtyeightyfourteentyeighteenty ninth
- 69627:sixtyeightysixteentytwenty seventh
- 70172:sixtytentytysixteenty twelfth
- 71569:sixtytentyfourteentysixteenty ninth
- 71600:sixtytentysixteentytieth
- 71920:sixtytentyeighteentytwelftieth
- 72171:sixtytwelftytysixteenty eleventh
- 72180:sixtytwelftytyeighteentieth
- 73584:sixtytwelftyfourteentyeighteenty fourth
- 74298:sixtyfourteentytwentyeighty eighteenth
- 74790:sixtyfourteentysixtyeighteenty tenth
- 75930:sixtyfourteentyeighteentytwelfty tenth
- 78000:sixtyeighteentytytieth
- 78007:sixtyeighteentytyty seventh
- 79240:sixtyeighteentytwelftyfortieth
- 79877:sixtyeighteentyeighteentysixty seventeenth
- 80000:eightytytytieth
- 83458:eightytwentyfourteentyforty eighteenth
- 83900:eightytwentyeighteentytentieth
- 84672:eightyfortysixtysixty twelfth
- 85892:eightyfortyeighteentyeighty twelfth
- 85991:eightyfortyeighteentyeighteenty eleventh
- 86140:eightysixtytyfourteentieth
- 87608:eightysixtysixteentyty eighth
- 87861:eightysixtyeighteentysixty first
- 87954:eightysixtyeighteentyfourteenty fourteenth
- 88000:eightyeightytytieth
- 88329:eightyeightytwentytwelfty ninth
- 88484:eightyeightyfortyeighty fourth
- 88552:eightyeightyfortyfourteenty twelfth
- 88860:eightyeightyeightysixtieth
- 90180:eightytentytyeighteentieth
- 90935:eightytentyeightytwelfty fifteenth
- 92555:eightytwelftyfortyfourteenty fifteenth
- 93174:eightytwelftytentysixteenty fourteenth
- 93371:eightytwelftytwelftysixteenty eleventh
- 93610:eightytwelftysixteentyty tenth
- 93642:eightytwelftysixteentyforty second
- 94023:eightyfourteentytytwenty third
- 94175:eightyfourteentytysixteenty fifteenth
- 94576:eightyfourteentyfortysixteenty sixteenth
- 94981:eightyfourteentyeightyeighteenty first
- 95797:eightyfourteentysixteentyeighteenty seventeenth
- 96134:eightysixteentytytwelfty fourteenth
- 96826:eightysixteentyeightytwenty sixth
- 97280:eightysixteentytwelftyeightieth
- ```
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#1: Initial revision
Awkward Ordinals
Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are **not** the [conventional ordinal names](https://en.wikipedia.org/wiki/Ordinal_numeral), although there is significant overlap. You are free to use any approach that happens to pass all the test cases. ## Input - A positive integer from the test cases. - You are not required to support any input not listed in the test cases. ## Output - The corresponding string from the test cases. - This must be in the exact format shown, including having spaces in and only in the specified places. ## Example Given input `224`: - The correct output is `twentytwenty fourth`. - It is incorrect to output `twenty twenty fourth` (due to the extra space). - It is incorrect to output `twentytwentyfourth` (due to the missing space). ## Test cases Test cases are in the format `input:output` where the input is a positive integer, and the output is made up solely of lower case letters and sometimes spaces. There are 248 test cases, spread between 1, 2, 3, 4, and 5 digit inputs. ```text 1:first 2:second 3:third 4:fourth 5:fifth 6:sixth 7:seventh 8:eighth 9:ninth 10:tenth 11:eleventh 12:twelfth 13:thirteenth 14:fourteenth 15:fifteenth 16:sixteenth 17:seventeenth 18:eighteenth 19:nineteenth 20:twentieth 21:twenty first 22:twenty second 23:twenty third 24:twenty fourth 25:twenty fifth 26:twenty sixth 27:twenty seventh 28:twenty eighth 29:twenty ninth 30:twenty tenth 31:twenty eleventh 32:twenty twelfth 33:twenty thirteenth 34:twenty fourteenth 35:twenty fifteenth 36:twenty sixteenth 37:twenty seventeenth 38:twenty eighteenth 39:twenty nineteenth 40:fortieth 41:forty first 44:forty fourth 47:forty seventh 50:forty tenth 53:forty thirteenth 56:forty sixteenth 59:forty nineteenth 62:sixty second 65:sixty fifth 68:sixty eighth 71:sixty eleventh 74:sixty fourteenth 77:sixty seventeenth 80:eightieth 83:eighty third 86:eighty sixth 89:eighty ninth 92:eighty twelfth 95:eighty fifteenth 98:eighty eighteenth 105:tenty fifth 112:tenty twelfth 119:tenty nineteenth 126:twelfty sixth 133:twelfty thirteenth 140:fourteentieth 147:fourteenty seventh 154:fourteenty fourteenth 161:sixteenty first 168:sixteenty eighth 175:sixteenty fifteenth 182:eighteenty second 189:eighteenty ninth 196:eighteenty sixteenth 203:twentyty third 210:twentyty tenth 217:twentyty seventeenth 224:twentytwenty fourth 231:twentytwenty eleventh 250:twentyforty tenth 269:twentysixty ninth 288:twentyeighty eighth 307:twentytenty seventh 326:twentytwelfty sixth 345:twentyfourteenty fifth 364:twentysixteenty fourth 383:twentyeighteenty third 402:fortyty second 421:fortytwenty first 440:fortyfortieth 459:fortyforty nineteenth 478:fortysixty eighteenth 497:fortyeighty seventeenth 516:fortytenty sixteenth 535:fortytwelfty fifteenth 554:fortyfourteenty fourteenth 573:fortysixteenty thirteenth 592:fortyeighteenty twelfth 880:eightyeightieth 1283:twelftyeighty third 1400:fourteentytieth 1617:sixteentyty seventeenth 4360:fortytwentysixteentieth 4895:fortyeightyeighty fifteenth 6802:sixtyeightyty second 6837:sixtyeightytwenty seventeenth 7999:sixtyeighteentyeighteenty nineteenth 8320:eightytwentytwelftieth 8944:eightyeightyfourteenty fourth 9274:eightytwelftysixty fourteenth 9353:eightytwelftyfourteenty thirteenth 10008:tentytyty eighth 10045:tentytyforty fifth 10405:tentyfortyty fifth 10731:tentysixtytwelfty eleventh 10740:tentysixtyfourteentieth 11320:tentytwelftytwelftieth 13206:twelftytwelftyty sixth 13240:twelftytwelftyfortieth 13415:twelftyfourteentyty fifteenth 13471:twelftyfourteentysixty eleventh 14616:fourteentysixtyty sixteenth 15348:fourteentytwelftyfourteenty eighth 15560:fourteentyfourteentysixteentieth 16000:sixteentytytieth 17333:sixteentytwelftytwelfty thirteenth 18066:eighteentytysixty sixth 18263:eighteentytwentysixty third 18976:eighteentyeightysixteenty sixteenth 20017:twentytytyty seventeenth 20018:twentytytyty eighteenth 20260:twentytytwentysixtieth 20955:twentytyeightyfourteenty fifteenth 21445:twentytyfourteentyforty fifth 21553:twentytyfourteentyfourteenty thirteenth 21860:twentytyeighteentysixtieth 25188:twentyfortytentyeighteenty eighth 25529:twentyfortyfourteentytwelfty ninth 27360:twentysixtytwelftysixteentieth 27772:twentysixtysixteentysixteenty twelfth 28061:twentyeightytysixty first 28800:twentyeightyeightytieth 29220:twentyeightytwelftytwentieth 29740:twentyeightysixteentyfourteentieth 29950:twentyeightyeighteentyfourteenty tenth 30340:twentytentytwentyfourteentieth 31036:twentytentytentytwenty sixteenth 31600:twentytentysixteentytieth 33680:twentytwelftysixteentyeightieth 33719:twentytwelftysixteentytenty nineteenth 34019:twentyfourteentytyty nineteenth 34341:twentyfourteentytwentyfourteenty first 34526:twentyfourteentyfortytwelfty sixth 34713:twentyfourteentysixtytenty thirteenth 34715:twentyfourteentysixtytenty fifteenth 36650:twentysixteentysixtyforty tenth 37381:twentysixteentytwelftyeighteenty first 37780:twentysixteentysixteentyeighteentieth 38299:twentyeighteentytwentyeighty nineteenth 38982:twentyeighteentyeightyeighteenty second 40000:fortytytytieth 40907:fortytyeightytenty seventh 41849:fortytyeighteentyforty ninth 42000:fortytwentytytieth 42527:fortytwentyfortytwelfty seventh 43356:fortytwentytwelftyfourteenty sixteenth 43382:fortytwentytwelftyeighteenty second 44003:fortyfortytyty third 45187:fortyfortytentyeighteenty seventh 45208:fortyfortytwelftyty eighth 46220:fortysixtytwentytwentieth 46827:fortysixtyeightytwenty seventh 47436:fortysixtyfourteentytwenty sixteenth 47744:fortysixtysixteentyfourteenty fourth 47800:fortysixtyeighteentytieth 48198:fortyeightytyeighteenty eighteenth 52100:fortytwelftytytentieth 54000:fortyfourteentytytieth 57340:fortysixteentytwelftyfourteentieth 58010:fortyeighteentytyty tenth 58705:fortyeighteentysixtytenty fifth 59400:fortyeighteentyfourteentytieth 59713:fortyeighteentysixteentytenty thirteenth 60000:sixtytytytieth 60019:sixtytytyty nineteenth 60189:sixtytytyeighteenty ninth 60941:sixtytyeightyfourteenty first 62220:sixtytwentytwentytwentieth 62314:sixtytwentytwentytenty fourteenth 62754:sixtytwentysixtyfourteenty fourteenth 63540:sixtytwentyfourteentyfourteentieth 63965:sixtytwentyeighteentysixteenty fifth 64040:sixtyfortytyfortieth 64943:sixtyfortyeightyfourteenty third 65063:sixtyfortytentysixty third 65064:sixtyfortytentysixty fourth 65661:sixtyfortysixteentysixty first 65700:sixtyfortysixteentytentieth 65809:sixtyfortyeighteentyty ninth 65972:sixtyfortyeighteentysixteenty twelfth 66000:sixtysixtytytieth 69219:sixtyeightytwelftyty nineteenth 69589:sixtyeightyfourteentyeighteenty ninth 69627:sixtyeightysixteentytwenty seventh 70172:sixtytentytysixteenty twelfth 71569:sixtytentyfourteentysixteenty ninth 71600:sixtytentysixteentytieth 71920:sixtytentyeighteentytwelftieth 72171:sixtytwelftytysixteenty eleventh 72180:sixtytwelftytyeighteentieth 73584:sixtytwelftyfourteentyeighteenty fourth 74298:sixtyfourteentytwentyeighty eighteenth 74790:sixtyfourteentysixtyeighteenty tenth 75930:sixtyfourteentyeighteentytwelfty tenth 78000:sixtyeighteentytytieth 78007:sixtyeighteentytyty seventh 79240:sixtyeighteentytwelftyfortieth 79877:sixtyeighteentyeighteentysixty seventeenth 80000:eightytytytieth 83458:eightytwentyfourteentyforty eighteenth 83900:eightytwentyeighteentytentieth 84672:eightyfortysixtysixty twelfth 85892:eightyfortyeighteentyeighty twelfth 85991:eightyfortyeighteentyeighteenty eleventh 86140:eightysixtytyfourteentieth 87608:eightysixtysixteentyty eighth 87861:eightysixtyeighteentysixty first 87954:eightysixtyeighteentyfourteenty fourteenth 88000:eightyeightytytieth 88329:eightyeightytwentytwelfty ninth 88484:eightyeightyfortyeighty fourth 88552:eightyeightyfortyfourteenty twelfth 88860:eightyeightyeightysixtieth 90180:eightytentytyeighteentieth 90935:eightytentyeightytwelfty fifteenth 92555:eightytwelftyfortyfourteenty fifteenth 93174:eightytwelftytentysixteenty fourteenth 93371:eightytwelftytwelftysixteenty eleventh 93610:eightytwelftysixteentyty tenth 93642:eightytwelftysixteentyforty second 94023:eightyfourteentytytwenty third 94175:eightyfourteentytysixteenty fifteenth 94576:eightyfourteentyfortysixteenty sixteenth 94981:eightyfourteentyeightyeighteenty first 95797:eightyfourteentysixteentyeighteenty seventeenth 96134:eightysixteentytytwelfty fourteenth 96826:eightysixteentyeightytwenty sixth 97280:eightysixteentytwelftyeightieth ``` ## Scoring This is a [code golf challenge]. Your score is the number of bytes in your code. > Explanations are optional, but I'm more likely to upvote answers that have one. [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"