45
4
The French spell out numbers in a peculiar way.
- 1-16 are "normal"
- 17-19 are spelled out 10+7. 10+8, 10+9.
- 20-69 are "normal" (OK, OK! Not really, but they are in this challenge)
- 70-79 are 60+10, 60+11 ... 60+10+7, 60+10+8, 60+10+9.
- 80-99 are 4*20, 4*20+1, 4*20+2 ... 4*20+16, 4*20+10+7, 4*20+10+8, 4*20+10+9
Challenge:
Take a positive integer in the range [1,100], and output it the "French way". You must output it exactly as it's shown below, with *
and +
, so 97
is 4*20+10+7
, not [4 20 10 7]
or something else.
Test cases:
1 - 1
.. - ..
16 - 16
17 - 10+7
18 - 10+8
19 - 10+9
20 - 20
21 - 21
.. - ..
69 - 69
70 - 60+10
71 - 60+11
72 - 60+12
77 - 60+10+7
78 - 60+10+8
79 - 60+10+9
80 - 4*20
81 - 4*20+1
82 - 4*20+2
.. - ..
90 - 4*20+10
91 - 4*20+11
96 - 4*20+16
97 - 4*20+10+7
98 - 4*20+10+8
99 - 4*20+10+9
100 - 100
15Every language I know has a transition in the "teens", like the one from
16
to10+7
above. (In English it happens between12
and10+3
, with a little more morphological disguise.) I've always been a little overobsessed with the fact that different languages make that transition at different numbers. – Greg Martin – 2017-04-26T22:23:33.32325Why should "vingt-deux" be
22
when "dix-huit" is10+8
? – Titus – 2017-04-27T00:54:16.200@GregMartin Intriguing, I agree. Even the Romance languages do it at different numbers, oddly! (Spanish at 16, Italian and French at 17, albeit with different morphologies, and Latin not at all.) – Noldorin – 2017-04-27T01:31:02.793
11Luckily, this is a programming puzzle site and not a linguistic trivia site. Otherwise people might get annoyed when OP makes silly mistakes. Phew! – Stewie Griffin – 2017-04-27T08:41:21.697
4@StewieGriffin People still got annoyed. – Leaky Nun – 2017-04-27T08:47:31.460
And strictly speaking, although not obviously so, 11 is 1+10 (onze < undecim), 12 is 2+10 (douze < duodecim), 13 is 3+10 (treize < tredecim), 14 is 4+10 (quatorze < quattuordecim), 15 is 5+10 (quinze < quindecim), and 16 is 6+10 (seize < sedecim). – Leaky Nun – 2017-04-27T08:50:45.097
2As a french I do find it quite fine :D. – Walfrat – 2017-04-27T12:51:54.570
1As a French speaking Swiss, that disturbs me a bit (for me: soixante-dix = septante, quatre-vingts = huitante, quatre-vingt-dix = nonante). Your challenge would be so much less challenging, though. – SteeveDroz – 2017-05-02T09:21:41.410
A curious fact is the language of love stops at 69! – sergiol – 2017-10-21T01:10:51.880