Conta fino a 100 in danese


37

Stampa tutti i numeri da 0 a 100 nell'ordine giusto usando il modo danese di contare

Come contano

  • Come l'inglese, hanno parole dedicate per 0-20, 30, 40 e 100
  • Invece di dire twenty-onee twenty-two, dicono one and twentyetwo and twenty
  • A partire da cinquanta dicono multipli di 10 come n * 20

    50 = half third times twenty = half way to the 3rd multiple of 20
    60 = three times twenty
    70 = half fourth times twenty
    80 = four times twenty
    90 = half fifth times twenty
    

    Ad esempio, 55 sarebbero five and half third times twenty.

Uscita prevista

zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
one and twenty
two and twenty
three and twenty
four and twenty
five and twenty
six and twenty
seven and twenty
eight and twenty
nine and twenty
thirty
one and thirty
two and thirty
three and thirty
four and thirty
five and thirty
six and thirty
seven and thirty
eight and thirty
nine and thirty
forty
one and forty
two and forty
three and forty
four and forty
five and forty
six and forty
seven and forty
eight and forty
nine and forty
half third times twenty
one and half third times twenty
two and half third times twenty
three and half third times twenty
four and half third times twenty
five and half third times twenty
six and half third times twenty
seven and half third times twenty
eight and half third times twenty
nine and half third times twenty
three times twenty
one and three times twenty
two and three times twenty
three and three times twenty
four and three times twenty
five and three times twenty
six and three times twenty
seven and three times twenty
eight and three times twenty
nine and three times twenty
half fourth times twenty
one and half fourth times twenty
two and half fourth times twenty
three and half fourth times twenty
four and half fourth times twenty
five and half fourth times twenty
six and half fourth times twenty
seven and half fourth times twenty
eight and half fourth times twenty
nine and half fourth times twenty
four times twenty
one and four times twenty
two and four times twenty
three and four times twenty
four and four times twenty
five and four times twenty
six and four times twenty
seven and four times twenty
eight and four times twenty
nine and four times twenty
half fifth times twenty
one and half fifth times twenty
two and half fifth times twenty
three and half fifth times twenty
four and half fifth times twenty
five and half fifth times twenty
six and half fifth times twenty
seven and half fifth times twenty
eight and half fifth times twenty
nine and half fifth times twenty
one hundred

Regole

  • È possibile utilizzare qualsiasi separatore per separare i numeri
  • A causa di un refuso nelle specifiche originali, è possibile utilizzare forthinvece difourth .
  • È possibile scrivere una funzione o scrivere su std-out
  • Si applicano scappatoie standard
  • Questo è codegolf; vince il codice più breve in byte!


4
Perché tutti gli spazi? 55 è femoghalvtredsindstyve in danese, non fem og halv tred sinds tyve .
Adám,

11
La produzione prevista mi sembra decisamente non danese. (E 55 è femoghalvtreds , non femoghalvtredsinstyve a meno che tu non sia deliberatamente arcaico).
Henning Makholm,

8
@Adám Ho deciso di usare parole inglesi anziché danesi per rendere la sfida più accessibile e non contraggiamo parole in inglese.
BlackCap

6
@ BlackCap: alcune parole si contraggono nel tempo. Ad esempio, è uno screenshot , non una schermata .
Peter Mortensen,

Risposte:


14

JavaScript (ES6), 347 336 326 325 308 byte

for(a=btoa`...`.split(i=0);i<101;i++)alert(i<13?a[i]:i<20?(a[i]||a[i-10])+"teen":i>99?"one hundred":(i%10?a[i%10]+" and ":"")+(i<30?"twenty":i<40?"thirty":i<50?"forty":(i%20>9?"half "+["third","forth","fifth"][i/20-2|0]:a[i/20|0])+" times twenty"))

Prima di eseguire, sostituire il ...con il risultato dell'esecuzione di questo codice:

atob("zero0one0two0three0four0five0six0seven0eight0nine0ten0eleven0twelve0thir00fif000eigh")

Oppure potresti semplicemente usare la versione non compressa:

for(a="zero0one0two0three0four0five0six0seven0eight0nine0ten0eleven0twelve0thir00fif000eigh".split(i=0);i<101;i++)alert(i<13?a[i]:i<20?(a[i]||a[i-10])+"teen":i>99?"one hundred":(i%10?a[i%10]+" and ":"")+(i<30?"twenty":i<40?"thirty":i<50?"forty":(i%20>9?"half "+["third","forth","fifth"][i/20-2|0]:a[i/20|0])+" times twenty"))

Probabilmente non è ancora ottimale. 11 byte salvati in parte da @Titus.


Mi sbagliavo. questo è un modo ragionevole per golfare le eccezioni.
Tito,

-7 byte: (x%20>9?"half ":"")+[third,forth,fifth][x/20-2.5|0]anziché(x%20>9?"half "+[third,forth,fifth][x/20-2.5|0]:f(x/20|0))
Tito

@Titus Se capisco cosa intendi, ciò genera un output errato per 60, 61, ..., 69, 80, 81 ... (es. third times twentyInvece di three times twenty)
ETHproductions

Oh mi mancava quella differenza. Hai ragione. Ma sbarazzarsi della ricorsione; che farà spazio a un po 'più di golf.
Tito,

@Titus Grazie per la punta. Non me ne sono accorto, ma la ricorsione mi stava effettivamente salvando esattamente 0 byte rispetto alla non ricorsione. Ho cambiato e golf un po 'di più ora.
ETHproductions

13

Fourier , 7028 byte

La generosità andrà a risposta di Paul Schmitz

Questo è stato golfato a livello di codice utilizzando il programma di golf di issacg

122a101a114a-3a10a111ava-9a10a116a+3a-8a10a116a104a114a101aa10a102a+9a+6a-3a10a102a+3a118a101a10a115a105a120a10a115a101a118a101a+9a10a101a+4a-2a^a116a10a110a-5a+5a-9a10a116a101a+9a10a101a+7a-7a118a101a+9a10a116a+3a101a+7a118a101a10a116a104a^a+9a+2a101aa+9a10a102a+9a+6a-3a+2a101aa+9a10a102a+3a-3a116a101aa+9a10a115a105a120a-4a101aa+9a10a115a101a118a101a+9a+6a101aa+9a10a101a+4a-2a^a116a101aa+9a10a110a-5a+5a-9a116a101aa+9a10a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a104a^a+9a+2a+5a10a111ava-9a32a97a110a100a32a116a104a^a+9a+2a+5a10a116a+3a-8a32a97a110a100a32a116a104a^a+9a+2a+5a10a116a104a114a101aa32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+9a+6a-3a32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+3a118a101a32a97a110a100a32a116a104a^a+9a+2a+5a10a115a105a120a32a97a110a100a32a116a104a^a+9a+2a+5a10a115a101a118a101a+9a32a97a110a100a32a116a104a^a+9a+2a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a104a^a+9a+2a+5a10a110a-5a+5a-9a32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+9a+3a+2a+5a10a111ava-9a32a97a110a100a32a102a+9a+3a+2a+5a10a116a+3a-8a32a97a110a100a32a102a+9a+3a+2a+5a10a116a104a114a101aa32a97a110a100a32a102a+9a+3a+2a+5a10a102a+9a+6a-3a32a97a110a100a32a102a+9a+3a+2a+5a10a102a+3a118a101a32a97a110a100a32a102a+9a+3a+2a+5a10a115a105a120a32a97a110a100a32a102a+9a+3a+2a+5a10a115a101a118a101a+9a32a97a110a100a32a102a+9a+3a+2a+5a10a101a+4a-2a^a116a32a97a110a100a32a102a+9a+3a+2a+5a10a110a-5a+5a-9a32a97a110a100a32a102a+9a+3a+2a+5a10a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a104a117a-7a100a114a101ava

Provalo online!


Ecco un suggerimento: basta stampare l'output. È composto da 1989 caratteri che utilizzano lo stesso numero di byte.
DavidC

2
@DavidC Per quanto ne so questo è come "semplicemente stampare l'output" in Fourier. Non ci sono letterali stringa se questo è ciò che intendevi.
Martin Ender,

@DavidC Martin ha ragione, le stringhe non esistono in Fourier
Beta Decay

Mio Dio, sembra un linguaggio molto strano!
DavidC

Ho ottenuto 7020 byte. pastebin.com/WGtHSGFT
Paul Schmitz,

8

JavaScript (ES6), non concorrenziale

I decided to do what the title actually asked, and counted to 100 på dansk. This is based on ETHproductions' answer. It is 292 bytes (286 if you use alert instead)

for(a="nul0en0to0tre0fire0fem0seks0syv0otte0ni0ti0elleve0tolv0tret0fjor0fem0seks0syt0at0nit".split(i=0);i<101;i++)console.log(i<13?a[i]:i<20?(a[i])+"ten":i>99?"hundrede":(i%10?a[i%10]+"og":"")+(["tyve","tredive","fyrre","halvtreds","tres","halvfjerds","firs","halvfems"][Math.floor(i/10)-2]))


To be fair, you should append instyve to every number that ends in s.
Adám

@Adám: Why so? The -sinstyve is etymology, not actual Danish as currently spoken.
Henning Makholm

Yeah, but the English OP does include it, otherwise it should say 55 would be five and half third t.
Adám

8

Mathematica 251 238 230 bytes

This now presents the output in the format of a list, to save 8 more bytes.

c@s_:=s<>" times twenty";f@n_:=Which[n<21∨{30,40,100}~MemberQ~n,IntegerName@n,n==50,c@"half third",n==60,c@"three",n==70,c@"half forth",n==80,c@"four",n==90,c@"half fifth",3>2,NumberExpand@n/.{t_,u_}:>f@u<>" plus "<>f@t];f/@0~Range~100

I'm really jealous of that IntegerName function
BlackCap

Yeah, it does a good amount of the work. NumberExpand is also useful for decomposing a number (in any base). `NumberExpand[943]-> {900,40,3}
DavidC

7

///, 434 bytes

/(/\/\///D/\/7(7/ and (2/twenty(4/ times (_/half ([/42
(&/three(;/thir()/four(!/fort($/_fifth[(#/seven(^/eight(@D;ty
(%D_!h[(*D_;d[(-/nine(`D!y
(F/five(T/teen
(O/one(X/six(GD&[(HD)[(ID2
(Y/two(AD$/zero
O
Y
&
)
F
X
#
^
-
ten
eleven
twelve
;T)TfifTXT#T^een
-T2
OIYI&I)IFIXI#I^I-I;ty
O@Y@&@)@F@X@#@^@-@!y
O`Y`&`)`F`X`#`^`-`_;d42
O*Y*&*)*F*X*#*^*-*&[OGYG&G)GFGXG#G^G-G_!h[O%Y%&%)%F%X%#%^%-%)[OHYH&H)HFHXH#H^H-H$OAYA&A)AFAXA#A^A-AO hundred

Try it online!


7

PHP, 397 375 372 381 386 365 bytes

This was too funny to be ignored. It can possibly be golfed further.

zero_<?=join(_,$a=[one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen])._;foreach([twenty,thirty,forty]as$t)for($i=-2;$i++<8;)echo($i<0?'':$c[]="$a[$i] and ").$t._;foreach([third,three,fourth,four,fifth]as$k=>$t)for($i=-2;$i++<8;)echo$c[$i],($k&1?'':'half '),"$t times twenty_";?>one hundred
  • It uses underscore as the separator
  • 10 to 19 are still hardcoded; any way to compute them doesn´t give as much as the join.

5

PHP, 333 328 321 bytes

@ETHproductions´s expression ported to PHP and golfed down. I am surprised that PHP can beat JavaScript without any builtins.

I guess the mightiest builtins are the implicit typecasts:

  • I need no quotes for most of the strings, that alone is worth 12 bytes;
  • and it allows me to use an array directly instead of splitting a string.
  • the array indexing is implicitly typecasting any floats to integer, saving 6 bytes.

BUT: I need $s (21 of them) to tell PHP that it´s a variable.

So it´s still unclear where the 15 bytes actually come from. I didn´t golf away that much. Or did I? ETH caught up.

<?$a=[zero,one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,'',fifteen,'','',eighteen];for($n=-1;$n++<99;)echo$n>19?($n%10?$a[$n%10].' and ':'').($n>49?($n%20>9?"half ".[third,forth,fifth][$n/20-2.5]:$a[$n/20]).' times twenty':[twen,thir,'for'][$n/10-2].ty):($a[$n]?:$a[$n%10].teen),_;?>one hundred

Beating you now ;)
ETHproductions

5

C (gcc), 445 426 452 449 444 439 bytes

*t[]={0,0,"twenty","thirty","fourty",[10]="one hundred","third","fourth","fifth"},*o[101]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};i,p;main(j){for(;i<'e';i++)p=i%10,o[i]?puts(o[i]):printf("%s%s%s%s%s%s\n",p?o[p]:t,p?" and ":t,!t[j]&j%2?"half ":t,t[j]?t:j%2?t[j/2+9]:o[j/2],t[j]?t:" times ",t[j=i/10]?:t[2]);}

Try it online!

19 22 27 bytes shaved off thanks to @ceilingcat, but 26 bytes were added again, 3 to prevent a segfault (o[] really has to have 101 entries), and upon checking the rules again I noticed we had to print out all numbers from 0 to 100, not just provide a function that printed one number.

Ungolfed:

char *t[] = {0, 0, "twenty", "thirty", "fourty", 0, 0, 0, 0, 0, "one hundred", "third", "fourth", "fifth"};
char *o[101] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
                "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
int i = 0;
int j = 0;
int p = 0;

main()
{
  for(; i < 101; i++) {
    p = i % 10;
    if(o[i])
        puts(o[i]);
    else
        printf("%s%s%s%s%s%s\n",
               p ? o[p] : "",
               p ? " and " : "",
               !t[j] & j % 2 ? "half " : "",
               t[j] ? "" : j % 2 ? t[j / 2 + 9] : o[j / 2],
               t[j] ? "" : " times ",
               t[j = i / 10] ? : t[2]
        );
  }
}
```

4

Fourier, 7020 bytes

122a101~za114a-3a10a111ava-9a10a116a+3a-8a10a116a104a114a101aa10a102a+9a+6a-3a10a102a+3a118a101a10a115a105a120a10a115a101a118a101a+9a10a101a+4a-2a^a116a10a110a-5a+5a-9a10a116a101a+9a10a101a+7a-7a118aza+9a10a116a+3a101a+7a118a101a10a116a104a^a+9a+2a101aa+9a10a102a+9a+6a-3a+2a101aa+9a10a102a+3a-3a116a101aa+9a10a115a105a120a-4a101aa+9a10a115a101a118aza+9a+6a101aa+9a10aza+4a-2a^a116a101aa+9a10a110a-5a+5a-9a116a101aa+9a10a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a104a114azaa32a97a110a100a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a116a+3a101a+9a+6a+5a10a102a+3a118aza32a97a110a100a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a116a+3a101a+9a+6a+5a10a116a104a^a+9a+2a+5a10a111ava-9a32a97a110a100a32a116a104a^a+9a+2a+5a10a116a+3a-8a32a97a110a100a32a116a104a^a+9a+2a+5a10a116a104a114a101aa32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+9a+6a-3a32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+3a118a101a32a97a110a100a32a116a104a^a+9a+2a+5a10a115a105a120a32a97a110a100a32a116a104a^a+9a+2a+5a10a115a101a118a101a+9a32a97a110a100a32a116a104a^a+9a+2a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a104a^a+9a+2a+5a10a110a-5a+5a-9a32a97a110a100a32a116a104a^a+9a+2a+5a10a102a+9a+3a+2a+5a10a111ava-9a32a97a110a100a32a102a+9a+3a+2a+5a10a116a+3a-8a32a97a110a100a32a102a+9a+3a+2a+5a10a116a104a114a101aa32a97a110a100a32a102a+9a+3a+2a+5a10a102a+9a+6a-3a32a97a110a100a32a102a+9a+3a+2a+5a10a102a+3a118a101a32a97a110a100a32a102a+9a+3a+2a+5a10a115a105a120a32a97a110a100a32a102a+9a+3a+2a+5a10a115a101a118a101a+9a32a97a110a100a32a102a+9a+3a+2a+5a10a101a+4a-2a^a116a32a97a110a100a32a102a+9a+3a+2a+5a10a110a-5a+5a-9a32a97a110a100a32a102a+9a+3a+2a+5a10a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a116a104a^a+9a100a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a116a104a114a101aa32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a102a+9a+6a-3a+2a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a102a+9a+6a-3a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a+3a-8a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a116a104a114a101aa32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+9a+6a-3a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a102a+3a118a101a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a105a120a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a115a101a118a101a+9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a101a+4a-2a^a116a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a110a-5a+5a-9a32a97a110a100a32a104a97a108a-6a32a102a+3a-3a116a104a32a116a105a+4a-8a115a32a116a+3a101a+9a+6a+5a10a111ava-9a32a104a117a-7a100a114a101ava

This is an improved version of Beta Decays program.


4

Haskell, 308 291 285 bytes

w=words;q x=map(++x);m=w"thir four fif six seven eigh nine";t=w"zero one two three four five six seven eight nine ten eleven twelve"++q"teen"m++q"ty"(do b<-"twen":take 2m++q" times twen"["half third",t!!3,"half fourth",t!!4,"half fifth"];b:q b(q" and ".take 9$tail t))++["one hundred"]

Readable version:

w   = words
m   = w "thir four fif six seven eigh nine"
q x = map (++x)

t = w "zero one two three four five six seven eight nine ten eleven twelve"
 ++ q "teen" m 
 ++ q "ty" (do b <- "twen" : take 2 m
                     ++ q " times twen"
                          ["half third",t!!3,"half fourth",t!!4,"half fifth"]
               b:q b(q" and ".take 9$tail t)
           )
 ++ ["one hundred"]

Also 285

w=words;m=w"thir four fif six seven eigh nine";x!l=map(++x)l
t  = w"zero one two three four five six seven eight nine ten eleven twelve"
  ++ "teen"!m
  ++ "ty"!(
  do x<-"twen":take 2m++" times twen"!
         ["half third",t!!3,"half fourth",t!!4,"half fifth"]
     x:x!(" and "!take 9(tail t)))
  ++ ["one hundred"]

It might not look much different, but it represents hours of factorization that eventually brought me full circle. I think I have done this before..


Damn, Nordic-related challenge and so there already is a fp solution I can hardly improve on (fp being quite popular in the Nordics, no?)
Leif Willerts

@LeifWillerts I don't know anyone else who do fp, nor do they teach it in schools- sadly. You could try Lisp, it has format nil "~R" which converts numbers to their English text representation
BlackCap

Why do you suggest that Lisp? Well, I have been taught FP in Germany by a professor who had spent a lot of time at Chalmers in Sweden, and in here in Copenhagen they teach it on quite a high level and there is an active community in the city. Erlang was famously developed by Ericsson in Sweden. Where are you and what do you do?
Leif Willerts

@LeifWillerts I'm in Norway, just graduated from high-school and decided to work in webdev for a year before going to uni. I've obviously checked what options I have, and none of them are fp. None of my colleges or friends had even heard of functional programming before they met me.. Also, I suggested Lisp because half of my bytes come from storing numbers in strings, and you could get around that in Lisp.
BlackCap

Why is it non-competing? Just because you are OP doesn't mean non-competing AFAIK. Mods correct me if I'm wrong though...
Erik the Outgolfer

3

Python 2, 359 349 345 Bytes

a='one two three four five six seven eight nine'.split()
c=['ten','eleven','twelve']+[i+'teen'for i in['thir',a[3],'fif',a[5],a[6],'eigh',a[8]]]
p=' times twenty'
h='half '
x=[p[7:],'thirty','forty',h+'third'+p,a[2]+p,h+'forth'+p,a[3]+p,h+'fifth'+p]
f=['zero']+a+c
for i in x:f+=[i];f+=[b+' and '+i for b in a] 
for i in f+['one hundred']:print i

Explanation:

Create a list of the first 9 numbers.
Create a list of the next 10 numbers.
Create a list of the endings - twenty, thirty, forty, half third times twenty etc
Join the first two lists with zero
Append to the list each of the numbers from 50 onwards.
Print out list

Ungolfed code:

firstNumbers=['one','two','three','four','five','six','seven','eight','nine']
teenNumbers=['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
endings=['twenty','thirty','forty','half third times twenty','three times twenty','half forth times twenty','four times twenty','half fifth times twenty']
joined=['zero']+firstNumbers+teenNumbers
for ending in endings:
    joined.append(ending)
    for number in firstNumbers:
        joined.append(number + 'and' + ending)
joined.append('one hundred')
for line in joined:
    print line

Some golfing: teen line - remove space after in; move q into the only place it is used; do for i in f+['one hundred']:print i
Jonathan Allan

1
@JonathanAllan The score actually measured it with the q='and' - I'd noticed, just forgot to change it here! Thanks!
Tim

3

Python 2, with num2words, 206 bytes

Even with num2words it takes quite a few bytes!

This is a full program.

from num2words import num2words as w
for i in range(1,101):d=i/10;e=w(i).split('-');print' and '.join(e[1:]+[10>d>4 and((d%2 and'half '+{5:'third',7:'forth',9:'fifth'}[d]or w(d/2))+' times twenty')or e[0]])

Here is a mocked version on ideone
(By mocked I mean that since the online interpreter does not have num2words I replaced w with a lambda which looks up num2word's output in a list)

ungolfed and with 'fourth' rather than the allowed 'forth' (which saves a byte):

from num2words import num2words
for i in range(1,101):
    d = i / 10 # i div 10
    e = num2words(i).split('-') # i in English words with a "-" separator, split into parts
    if d > 4 and d < 10:
        if d % 2:
            p = 'half '+ {5:'third', 7:'fourth', 9:'fifth'}[d] + ' times twenty'
        else:
            p = num2words(d / 2) + ' times twenty'
    else:
        p = e[0]
    print' and '.join(e[1:]+[p])

Note that the separator used by num2words(100) is a space, whereas for the other numbers it is a "-", so we don't need to do anything fancy for that case other than stop it from being "five times twenty".


Aside

If the challenge were to actually produce the numbers in Danish one could take the lang_DK.py from the github page and use:

from num2words import*
[num2words(i,lang='dk')for i in range(1,101)]

for 68 bytes, yielding:

['et', 'to', 'tre', 'fire', 'fem', 'seks', 'syv', 'otte', 'ni', 'ti', 'elleve', 'tolv', 'tretten', 'fjorten', 'femten', 'seksten', 'sytten', 'atten', 'nitten', 'tyve', 'enogtyve', 'toogtyve', 'treogtyve', 'fireogtyve', 'femogtyve', 'seksogtyve', 'syvogtyve', 'otteogtyve', 'niogtyve', 'tredive', 'enogtredive', 'toogtredive', 'treogtredive', 'fireogtredive', 'femogtredive', 'seksogtredive', 'syvogtredive', 'otteogtredive', 'niogtredive', 'fyrre', 'enogfyrre', 'toogfyrre', 'treogfyrre', 'fireogfyrre', 'femogfyrre', 'seksogfyrre', 'syvogfyrre', 'otteogfyrre', 'niogfyrre', 'halvtreds', 'enoghalvtreds', 'tooghalvtreds', 'treoghalvtreds', 'fireoghalvtreds', 'femoghalvtreds', 'seksoghalvtreds', 'syvoghalvtreds', 'otteoghalvtreds', 'nioghalvtreds', 'treds', 'enogtreds', 'toogtreds', 'treogtreds', 'fireogtreds', 'femogtreds', 'seksogtreds', 'syvogtreds', 'otteogtreds', 'niogtreds', 'halvfjerds', 'enoghalvfjerds', 'tooghalvfjerds', 'treoghalvfjerds', 'fireoghalvfjerds', 'femoghalvfjerds', 'seksoghalvfjerds', 'syvoghalvfjerds', 'otteoghalvfjerds', 'nioghalvfjerds', 'firs', 'enogfirs', 'toogfirs', 'treogfirs', 'fireogfirs', 'femogfirs', 'seksogfirs', 'syvogfirs', 'otteogfirs', 'niogfirs', 'halvfems', 'enoghalvfems', 'tooghalvfems', 'treoghalvfems', 'fireoghalvfems', 'femoghalvfems', 'seksoghalvfems', 'syvoghalvfems', 'otteoghalvfems', 'nioghalvfems', 'ethundrede']

3

Bash (using rev and sed), 299 276 bytes

I'm using bash's curly braces-expansion. However the braces are expanded in the wrong order, so I print all the words in reverted order and then fix the order of the letters using rev. After that, I still need some adjustments using sed:

printf '%s\n' orez {,{neet,yt{newt,riht,rof},ytnewt\ semit\ {drihtX,eerht,htruofX,ruof,htfifX}}Y}{,eno,owt,eerht,ruof,evif,xis,neves,thgie,enin} derdnuh\ eno |rev |sed -r 's,^Yte,t,;s,^Y,,;12s,.*,eleven,;13s,o.*,elve,;1,20{s,reeY,ir,;s,veY,f,;s,(t|)Y,,};s,Y, and ,;s,X,half ,'

A bit less unreadable:

printf '%s\n' orez {,{neet,yt{newt,riht,rof},\
ytnewt\ semit\ {drihtX,eerht,htruofX,ruof,htfifX}}Y}\
{,eno,owt,eerht,ruof,evif,xis,neves,thgie,enin} \
    derdnuh\ eno \
    |rev \
    |sed -r 's,^Yte,t,;
            s,^Y,,;
            12s,.*,eleven,;
            13s,o.*,elve,;
            1,20{s,reeY,ir,;s,veY,f,;s,(t|)Y,,};
            s,Y, and ,;
            s,X,half ,'

2

JavaScript (ES6), 346 bytes

Only a small idea to ETHproductions' solution: Replace f(..) with a[..] to be able to call f recursively to concat the output.

f=x=>(a="1one1two1three1four1five1six1seven1eight1nine1ten1eleven1twelve1thir11fif111eigh".split(1),x<1?"zero":f(x-1)+(x<13?a[x]:x<20?(a[x]||a[x-10])+"teen":x>99?"one hundred":(x%10?a[x%10]+" and ":"")+(x<50?"twen1thir1for".split(1)[x/10-2|0]+"ty":(x%20>9?"half "+"third1forth1fifth".split(1)[x/20-2.5|0]:a[x/20|0])+" times twenty")))+"\n"
f(100)

Still far away from optimal...


2

Java 8 7, 512 490 + 19(import) bytes

Needs an import import java.util.*;

<T>void y(List<T>l,T...a){for(T t:a)l.add(t);}List x(){String b="teen",c="twenty",d="half ",e=" times "+c;String[]a={"zero","one","two","three","four","five","six","seven","eight","nine"},f={c,"thirty","fourty",d+"third"+e,a[3]+e,d+"fourth"+e,a[4]+e,d+"fifth"+e};List<String>g=new ArrayList<>(Arrays.asList(a));y(g,"ten","eleven","twelve","thir"+b,a[4]+b,"fif"+b,a[6]+b,a[7]+b,"eigh"+b,a[9]+b);for(String h:f){y(g,h);for(int i=1;i<=9;i++)y(g,(a[i]+" and "+h));}y(g,"one hundred");return g;}

Ungolfed:

<T> void y(List<T> l, T... a) {
    for (T t : a) {
        l.add(t);
    }
}

List x() {
    String b = "teen", c = "twenty", d = "half ", e = " times " + c;
    String[] a = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"},
        f = {c, "thirty", "fourty", d + "third" + e, a[3] + e, d + "fourth" + e, a[4] + e, d + "fifth" + e};
    List<String> g = new ArrayList<>(Arrays.asList(a));
    y(g, "ten", "eleven", "twelve", "thir" + b, a[4] + b, "fif" + b, a[6] + b, a[7] + b, "eigh" + b, a[9] + b);

    for (String h : f) {
        y(g, h);
        for (int i = 1; i <= 9; i++) {
            y(g, (a[i] + " and " + h));
        }
    }

    y(g, "one hundred");
    return g;
}

To run this, simply call <instance>.x();. This now returns the list containing all numbers.

Try it here!


2

PHP , 318 Bytes

for($i=~0;$i++<100;)echo([0=>zero,10=>ten,eleven,twelve,thirteen,15=>fifteen,18=>eighteen,100=>"one hundred"][$i]??["",one,two,three,four,five,six,seven,eight,nine][$i%10].($i>20&&$i%10?" and ":"").["",teen,twenty,thirty,forty,"half third",three,"half fourth",four,"half fifth"][$i/10].($i>49?" times twenty":"")).",";

first pick with the Null coalescing operator ?? the exceptions.

this version with 314 Bytes is without the , at the end

zero<?php for($i=0;$i++<100;)echo",".([10=>ten,eleven,twelve,thirteen,15=>fifteen,18=>eighteen][$i]??["",one,two,three,four,five,six,seven,eight,nine][$i%10].($i>20&&$i%10?" and ":"").["",teen,twenty,thirty,forty,"half third",three,"half fourth",four,"half fifth"][$i/10].($i>49?" times twenty":""));?>,one hundred

2

05AB1E, 127 123 120 115 bytes

“¡×€µ‚•„í†ìˆÈŒšï¿Ÿ¯¥Š—¿áÓÁωª†ìdßàŒšdï¿dŸ¯een¥Šd“¤'…§:#©`…«¹¿œÖƒ#“‰ª„í¦ƒ†ì³ä“#ε…ÿ„Æ«¹NÈi„Š£ ì]«vyTG®Nè'€ƒ‚yª]„€µ°¡»

Try it online!

“¡× (...) Šd“         # dictionary string "zero one two ... sixd sevend eighteen nined"
¤                     # get the last letter ("d") without popping 
 '…§                  # dictionary string "teen"
    :                 # replace (changes all "d" to "teen" in the initial string)
     #                # split on spaces
      ©               # save this list to the register
       `              # dump all items on the stack
…«¹¿œÖƒ               # dictionary string "twenty thirty fourty"
       #              # split on spaces
“‰ª„í¦ƒ†ì³ä“          # dictionary string "third three fourth four fifth"
            #         # split on spaces
ε              ]      # for each:
 …ÿ„Æ«¹               #  append " times twenty"
       NÈi     ]      #  if the iteration count is even:
          „Š£ ì       #   prepend "half "
                «     # merge those two lists ([20, 30, 40] and [50, 60, 70, 80, 90])
v            ]        # for y in this list of names:
 y                    #  put y on the stack
  TG         ]        #  for N from 1 to 9:
    ®Nè               #   get the Nth element in the register
       '€ƒ‚           #   append "and"
           yª         #   append y
„€µ°¡                 # dictionary string "one hundred"
     »                # join the stack with newlines

1

ink, 286 bytes

-(c){
-c>11 and c<21:
{eleven|twelve|thir|four|fif|six|seven|eigh|nine}{||teen}
-c%10==1:
~temp t="{zero|ten|twenty|thirty|forty|{&half {third|fourth|fifth}|{three|four|five}} times twenty}"
{t}
-1:
{&one|two|three|four|five|six|seven|eight|nine}{c>19: and {t}}
}
{c<100:->c}one hundred

Try it online!

Ink has sequences - they look like {a|b|c} and evaluate to a different value each time, until there's no next value at which point they stick with the last one - that's why {||teen} keeps outputting teen after it's output nothing the first two times it's encountered. By combining and nesting these, we can get pretty advanced with very little in the way of actual conditionals.

A sequence that begins with {& instead of just { is a cycle - those loop and that's how we count units and how we alternate between "half nth times twenty" and "n times twenty" for the tens.

We keep track of the name for the tens in a variable t which we only update every tenth pass through the loop. On the passes where we update the variable, we print only the variable, on other passes we use cycles to print the unit followed by and {t}.
With a handful exceptions - below ten we skip printing the tens (no three and zero) and the teens are irregular enough that they get a sequence all to themselves.

c is a labelled gather. Gathers by themselves don't do anything, but they can be diverted to as a form of control flow, and they keep track of how many times they've been visited - we use this readcount to special-case the teens, to know when we need to update the tens variable, and to know when to stop looping, wrap everything up and print one hundred.

I know I could save a byte by using "forth" instead of "fourth", but I'm choosing not to.

Ungolfed

- (c)
{
- c > 11 and c < 21:                                        // If c is strictly between 11 and 21 we're in the teens
  {eleven|twelve|thir|four|fif|six|seven|eigh|nine}{||teen} // They get a sequence of their own because they don't fit into the other numbers' pattern.
- c % 10 == 1:                                              // Otherwise, if we're meant to print a multiple of ten
  // Set the variable t to the multiple of ten we want. Note the cycle to alternate between "half nth" and "n"
  ~ temp t="{zero|ten|twenty|thirty|forty|{&half {third|fourth|fifth}|{three|four|five}} times twenty}"

  {t}                                                       // Print the contents of t
- else:                                                     // Otherwise, we go with the usual pattern
  {&one|two|three|four|five|six|seven|eight|nine}           // Print the unit - this is a cycle, so it loops when it's been run through nine times.
  {c > 10:<> and {t}}                                       // If we're past ten (and, since we didn't enter the "teens" section earlier, past twenty), also print the contents of the variable t.
}
{c < 100: -> c}                                             // If we've done all this fewer than a hundred times, we go back to the top.
one hundred                                                 // Print "one hundred"
// Out of content, end of program
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.