[Question]
  [
# Winner: [professorfish's bash answer](https://codegolf.stackexchange.com/questions/32151/convert-1-2-3-4-5-6-7-8-and-9-to-one-two-three-etc/32232#32232)! An entire 9 bytes! Wow!
You may continue to submit your answer, however you can no longer win. Original post kept for posterity:
---
Your goal is to convert a **whole** number between 1-9 into the word it represents.
* You will not need to worry about decimals
* The user will input a number. Assume that they will never enter anything 10 or higher
* The user must type the number at some point, **however** the method the program reads it does not matter. It can be with stdin, reading a text file, etc, however the user must press the 9 button on their keyboard (for example) at some point
* It is not case sensitive (ie, "one", "One", "oNe", "OnE", etc are all acceptable)
* HTTP/etc requests are allowed, **however** any code executed by the server the request is made to counts towards the byte count of your final code (e.g. if I had a C++ program make a HTTP request, the PHP code used in the HTTP request counts)
* Anything that can compile and run is acceptable
---
* This contest **has ended** on June 27th, 2014 (7 days from posting).
* This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code wins
  
[Answer]
## Python 2, 64
```
print' ottffssennwhoiieiieoruvxvgn  ere ehe  e   nt'[input()::9]
```
This is what the string looks like with some extra whitespace (try reading vertically):
```
o t t f f s s e n
n w h o i i e i i
e o r u v x v g n
    e r e   e h e 
    e       n t
```
As explained in the comments below, `[input()::9]` starts at the given index and selects every ninth subsequent character.
[Answer]
# Bash (with bsdgames), 9
```
number -l
```
Reads from standard input.
I don't know why there's a utility for this, but whatever.
[Answer]
# Common Lisp - 22 bytes
Here's a general one (not just for one-ten):
```
(format nil"~R"(read))
```
Oh, you want ordinals (first, second, ... three-hundredth...)? Ok!
```
(format nil"~:R"(read))
```
[Answer]
# BASH 51
So I made another one using my second idea plus some help from others:
```
set one two three four five six seven eight nine
$X
```
Where 'X' is the number you want.
---
# BASH 48 (67)
**67 with `\n` line breaks**
I'm not sure if this totally counts, because it's reading from a file, but:
`sed -n Xp a`
Where "X" is the input and where `a` is a file with:
```
one
two
three
four
five
six
seven
eight
nine
```
The file is 36 chars, and the bash command is 13.
How it works:
> 
>  Each line in the file is numbered, starting with 1. So 'one' is on the 1st line, 'two' on the 2nd. The command, `sed -n 'Xp' a` says, "Please print what's listed on line 'X' of file 'a'" `sed` is a Unix stream editor. `-n` means be silent, or only essentially ignore everything else. `Xp` means print what's on line 'X'.
> 
> 
> 
[Answer]
### C# - 127 ( 86 / 46)
If you only take the executable part...
```
Console.Write(((HourOfDay)Console.Read()-48));
```
and if `HourOfDay` would have been part of the the System namespace you would need 46 chars. Unfortunately it sits in `System.DirectoryServices.ActiveDirectory` which makes it 86...the other noise spoils it.
This is compileable and runnable from the commandline (127 chars):
```
using System;class P{static void Main(){Console.Write((System.DirectoryServices.ActiveDirectory.HourOfDay)Console.Read()-48);}}
```
if saved to a file called cg2.cs
```
csc cg2.cs /r:System.DirectoryServices.dll  && cg2
```
**How does this work?**
[`HourOfDay`](http://msdn.microsoft.com/en-US/library/system.directoryservices.activedirectory.hourofday(v=vs.110).aspx) is an enum type so we can use names instead of magic constants. Enum types have a ToString() implementation that gives you the [name of the value](http://msdn.microsoft.com/en-us/library/system.enum.getname(v=vs.110).aspx). You can cast an int to an enum. [Console.Read()](http://msdn.microsoft.com/en-us/library/system.console.read(v=vs.110).aspx) reads a character from the input stream represented as an integer. typing '1' gives [49](http://en.wikipedia.org/wiki/UTF-8#Codepage_layout), substract 48 to get 1, cast/box to `HourOfDay` to return 'One'. 
[Take a look at the Powershell version of this same trick](https://codegolf.stackexchange.com/a/32181/9393)
[Answer]
# Befunge 98, ~~116~~ ~~105~~ 103 bytes
```
&1-       v
vvvvvvvvvj<
"""""""""
etnxereoe
nheivuewn
igvsiorto
nie"ffh""
"es ""t
 ""   "
>>>>>>>>>4k,@
```
Befunge was not made for this...
Explanation:
```
&1-           ;Grab the input number (`n`) and subtract 1 from it
&1-       v   ;Start moving downwards
          <   ;Start moving leftwards
         j    ;Jump `n - 1` characters to the left.
vvvvvvvvvj    ;Redirect each of the possible locations to jump to, sending the IP down.
        "     ;If `n` was 1, push `o, n, e` onto the stack (`o` is at the bottom)
        e
        n
        o
        "
       "      ;If `n` was 2, push `t, w, o` onto the stack
       o
       w
       t
       "
    *
    *
    *
"             ;If `n` was 9, push `n, i, n, e` onto the stack
e
n
i
n
"
>>>>>>>>>     ;Collect all the different possible positions the IP could be in, and send it right
>>>>>>>>>4k,  ;Print the top 5 chars. If there are less than 5, the rest are null characters. This is allowed
            @ ;End of program
```
[Answer]
# Javascript 68
Atob / btoa can be a poor's man compressing tool
 ~~(but if you want to try this in console, you cannot copy from the formatted text you see at once. Go to 'edit' and copy from the source panel)~~
Markdown editor does not like some of the characters in this answer: some characters get lost at saving. Still, I think it's an editor problem, not mine. The lost characters are perfectly valid 8 bit unicode chars.  
(Or else I'm wrong, if this issue was already debated in meta, let me know)
Here is the version with offending characters escaped, each sequence \xNN should count 1
```
alert(btoa("×C§{Dð£Dá­ç´\x16\x8b«ÐX¯{D¢ÇD\x9e½éô\x12(!·Cb\x9dí").split(0)[prompt()])
```
**Simple Test**
In firefox console:
```
[0,1,2,3,4,5,6,7,8,9]
.map(x=>x +',' btoa("×C§{Dð£Dá­ç´\x16\x8b«ÐX¯{D¢ÇD\x9e½éô\x12(!·Cb\x9dí").split(0)[x])
```
[Answer]
# Javascript 73
```
alert('0one0two0three0four0five0six0seven0eight0nine'.split(0)[prompt()])
```
# 69
```
alert(btoa("ôéÞõ5õ1ëxO_¢êý|ÞöÈ±õ'xß^hSôØ§{Ý").split(9)[prompt()])
```
[Answer]
# Perl, 55
```
$_=(nine,eight,seven,six,five,four,three,two,one)[-$_]
```
It is run with option `-p` (+1 byte), e.g.:
```
perl -pe '$_=(nine,eight,seven,six,five,four,three,two,one)[-$_]'
```
Input is expected in STDIN and output is written to STDOUT.
The code just generates an array and selects the right element. Option `-p` takes care of reading the input line into `$_` and prints the result in `$_`.
**Variations:**
* With trailing new line (+3):
```
$_=(nine,eight,seven,six,five,four,three,two,one)[-$_].$/
```
or (same byte count):
```
s/./(nine,eight,seven,six,five,four,three,two,one)[-$&]/e
```
**Update:**
* Using bare words instead of `qw[...]` (thanks Zaid).
* Negative index saves a byte (thanks aragaer).
[Answer]
## Oracle SQL - 46
```
select to_char(to_date(&1,'j'),'jsp')from dual
```
[Demonstration](http://www.sqlfiddle.com/#!4/d41d8/31776)
This does include a [standard loophole](http://meta.codegolf.stackexchange.com/a/1078/3419), I admit, but the SQL is shorter than Golfscript; I couldn't resist!
It works by (ab)using Oracle's [datetime format models](http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements004.htm#i34924). `TO_DATE(n, 'j')` converts a number into a [Julian day](http://en.wikipedia.org/wiki/Julian_day), the number of days since January 1, 4712 BC. `TO_CHAR(<date>, 'jsp')` converts this back into the integer (though as a string). The `sp`, is a [format element suffix](http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements004.htm#SQLRF51083) that spells the number. This'll actually work with quite a lot of numbers.
The `&1` is a substitution variable that'll only work with clients that accept it, for instance SQL\*Plus.
[Answer]
# CJam, ~~45~~ 43 bytes
```
"^AM-^L8M-xM-^L^US^_M-^WrM-rM- 1M-s^CHM-|M-X^HE,M-qM-^EM-q4"256bKb'ef+'j/li=
```
The above uses ^ and M- notation, since some characters are unprintable.
At the cost of 9 more bytes, unprintable characters can be avoided:
```
" one two three four five six seven eight nine"S/li=
```
[Try it online.](http://cjam.aditsu.net/ "CJam interpreter")
### How it works
```
" Convert the string into an integer by considering it a base-256 number.                ";
"^AM-^L8M-xM-^L^US^_M-^WrM-rM- 1M-s^CHM-|M-X^HE,M-qM-^EM-q4"256b
" Convert the integer from above into an array by considering it a base-20 number.       ";
Kb
" Add the ASCII character code of “e” to all elements of that array. This casts to char. ";
'ef+
" So far, we've pushed the string “jonejtwojthreejfourjfivejsixjsevenjeightjnine”.       ";
" Split the the above string where the character “j” occurs.                             ";
'j/
" Read an integer from STDIN and push the corresponding substring.                       ";
li=
```
### Example
```
$ base64 -d > convert.cjam <<< IgGMOPiMFVMfl3LyoDHzA0j82AhFLPGF8TQiMjU2YktiJ2VmKydqL2xpPQ==
$ wc -c convert.cjam
43 convert.cjam
LANG=en_US cjam convert.cjam <<< 5
five
```
[Answer]
# GolfScript, 51 bytes
```
~'
one
two
three
four
five
six
seven
eight
nine'n/=
```
It's a simple lookup table. The input is evaluated (`~`), an array of the values is created, and the index is found.
[Try it here](http://golfscript.apphb.com/?c=OycxJwp%2BJwpvbmUKdHdvCnRocmVlCmZvdXIKZml2ZQpzaXgKc2V2ZW4KZWlnaHQKbmluZSduLz0%3D)
[Answer]
# bash say (OS X): ~~3~~ 8
"Your goal is to convert a whole number between 1-9 into the word it represents"
Last time I checked, spoken words are words as well.
Previous attempt (accepts no input)
~~`say 4`~~
Edit, must be able to read input:
```
say|read
```
Type any number and the word comes out. I know the end date is due, but in my opinion I should have won the contest.
Example audio file: [four.aiff](https://www.dropbox.com/s/dut3a1d36jyt97w/four.aiff) 
[Answer]
# Perl, 60 bytes
```
$_=(ZOneTwoThreeFourFiveSixSevenEightNine=~/.[a-z]*/g)[$_]
```
Requires the `-p` switch (two bytes).
### Example
```
$ perl -p convert.pl <<< 5
Five
```
### How it works
* `-p` reads from STDIN and saves the result in `$_`.
* `=~/.[a-z]*/g` splits the preceding bareword into substrings of one (uppercase) letter followed by any number of lowercase letters.
* `(…)` collects the substrings into an array.
* `[$_]` retrieves the substring corresponding to the user input.
* `$_=…` saves the result in `$_`.
* `-p` prints the value of `$_`.
[Answer]
# Bash + coreutils, 64
# Non-competitive compression concept
```
xxd -p<<<TàPnàõ:àsÀ~®@ãCN|tr 0-9a-d \\ng-inor-x|sed -n $1p
```
Some of the exotic characters here may not render well, so this script may be reconstructed from its base64 representation:
```
base64 -d <<< eHhkIC1wPDw8VOCLUIJu4PWWDzrgc8B+rkDjEoBDTnx0ciAwLTlhLWQgXFxuZy1pbm9yLXh8c2VkIC1uICQxcA==
```
### Example output
```
$ ./n.sh 1
one
$ ./n.sh 9
nine
$ 
```
### Explanation
It occurred to me that the string `one two three four five six seven eight nine` contains only the letters `efghinorstuvwx` and a space separator - 15 character values in total. Thus each character can potentially be represented in 4 bits, or 2 characters per 1 byte. We can use the hex representation of a byte as an easy way to split each byte into two hex digits. We can then transform the hex digits back to the letters we require using `tr` or similar. As luck would have it, `rstuvwx` are consecutive, so may be expressed as `r-x` to `tr`. The encoding is arranged such that `e` and `f` are left as-is, and that the words are line-break separated, so we can use `sed` to ouptut just the line we need.
This decoding process ends up using a fair amount of extra space, so makes this answer non-competitive as a shell-script-style answer, but may be a useful concept in other languages.
[Answer]
# Python 2.x - ~~65~~ 64
Not as good as @grc 's answer, but certainly more legible :-)
```
'one two three four five six seven eight nine'.split()[input()-1]
```
One less char, thanks to @flornquake
```
'nine eight seven six five four three two one'.split()[-input()]
```
[Answer]
## DOS Batch - 162 Chars (incl' line breaks)
This answer was inspired by @grc's Python answer, although I did have something similar in mind.
```
@setlocal enabledelayedexpansion
@set s="ottffssennwhoiieiieoruvxvgn  ere ehe  e   nt
@set /a c=%1
@set z=!s:~%c%,1!
@if _%z%==_ exit /b
@echo %z%
@%0 %c%+9
```
Usage:
[Filename] [number]
For example, if the code is in a file called speak.bat, and you want to see the number "five", you would run it as:
`speak 5`
Also, the output is top-to-bottom, not left-to-right! So instead of
> 
> five
> 
> 
> 
you will see
> 
> f  
> 
>  i  
> 
>  v  
> 
>  e 
> 
> 
> 
[Answer]
# (pure) Bash, 64
Takes input as its first argument, assuming valid input.
```
v=(o one two three four five six seven eight nine)
echo ${v[$1]}
```
Creates an array `v`, then accesses the element specified on the input. Since arrays are zero-indexed, I had to add a 0th element as a placeholder. Alternatively (thnx @DennisWilliamson for pointing this out):
```
v=(one two three four five six seven eight nine)
echo ${v[$1-1]}
```
[Answer]
## Java 7 - 185
```
class Num{
public static void main(String[] args) {
    System.out.print("ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE".split(",")[(new java.util.Scanner(System.in)).nextInt()-1]);
    }}
```
[Answer]
# C 111
```
#include <stdio.h>
int main(){printf("%.5s","one  two  threefour five six  seveneightnine"+5*(getchar()-'1'));}
```
The length here is carefully engineered so I can interpret it as binary and convert *that* to decimal. At only 7 characters, I'm confident I have a winner!
[Answer]
## VBScript 98 80 75
```
msgbox split(" one two three four five six seven eight nine")(inputbox(""))
```
[Answer]
# J - ~~68 or 60~~ 57 or 53 bytes
Interactive version (stdin):
```
>one`two`three`four`five`six`seven`eight`nine{~<:".1!:1]1
```
Function version:
```
f=:one`two`three`four`five`six`seven`eight`nine>@{~<:
```
Explanation:
```
f=:one`two`three`four`five`six`seven`eight`nine>@{~<:
                                                   <: Decrease by one
                                                 {~   Get the correct string
                                               >@     Unbox
```
`".(1!:1)1` reads a string and converts it to integer
[Answer]
# Perl 36 (58 standalone)
```
use Number::Spell;say spell_number<>
```
Or, without additional modules:
```
say qw(one two three four five six seven eight nine)[<>-1]
```
[Answer]
**In AppleScript ; 123 chars.**
```
{"one","two","three","four","five","six","seven","eight","nine"}'s item((display dialog""default answer"")'s text returned)
```
This script takes the input in a dialog. Then it gives the output in AppleScript’s *result*.
*Example :*
* Input : `6`
* Output : `"six"`
Here is a nicer version : 
```
set l to {"one","two","three","four","five","six","seven","eight","nine"}
set n to text returned of (display dialog "?" default answer "")
display dialog (l's item n) buttons ("OK") default button 1
```
This version displays the output in a nice dialog.
*Example :*
* Input : `9`
* Output : `nine`
*[ Answer edited ; slightly improved the dialog for the input ; still 124 chars. Answer edited again ; now 1 char less ! ]*
[Answer]
## Powershell - 91 74
```
[Enum]::ToObject([System.DirectoryServices.ActiveDirectory.HourOfDay],[Console]::Read()-48)
```
Found out how to cast to remove the Enum and ToObject call:
```
[System.DirectoryServices.ActiveDirectory.HourOfDay]([Console]::Read()-48)
```
**How does this work?**
HourOfDay is an enum type so we can use names instead of magic constants. Enum types have a ToString() implementation that gives you the name of the constant value. You can cast an int to an enum. [Console.Read()](http://msdn.microsoft.com/en-us/library/system.console.read(v=vs.110).aspx) reads a character from the input stream represented as an integer. typing '1' gives 49, substract 48 to get 1, cast to HourOfDay to return 'One'.
Because powershell does a ToString on all objects being written to the output stream and doesn't need the fluff to turn this into an executable this all that is needed besides powershell...
[Answer]
# CJam - 50
This is a plain ASCII solution that uses HTTP requests (this is allowed in the question):
```
"aj21.com/"r+g
```
On the server there are 9 plain-text files named 1, 2, ..., 9, each containing the corresponding word.
Total size: 14 + 3 ("one") + 3 ("two") + 5 + 4 + 4 + 3 + 5 + 5 + 4 = 50.  
It can be golfed more by using a shorter domain.
The online interpreter doesn't support HTTP requests, so the program needs to be run using the [java interpreter](http://sf.net/p/cjam).
[Answer]
# Batch - 86
Far shorter than the other batch answer, and actually surprisingly competitive.
```
for /f "tokens=%1" %%1 in ("one two three four five six seven eight nine") do echo>%%1
```
Used as `filename.bat number`, and the output is in the form of a file with the name of the correct number.
[Answer]
# Ruby 64
```
p %w?one two three four five six seven eight nine?[$*[0].to_i-1]
```
[Answer]
## BASH 9
shameless Linux-replica of [cousincoicane's answer](https://codegolf.stackexchange.com/a/32298/13171)
```
spd-say 1
```
speaks out one
[Answer]
# GolfScript, 50 bytes
I wanted to see if I could beat [Quincunx's 51-byte self-contained GolfScript solution](https://codegolf.stackexchange.com/questions/32151/convert-1-2-3-4-5-6-7-8-and-9-to-one-two-three-etc/32154#32154). Turns out that, with enough tricks, yes, I can — by one byte.
Since one of the tricks I'm using is the use of bytes outside the printable ASCII range, the resulting program is cannot be directly pasted here. Instead, I'm providing a hex dump of it; users on Unixish systems can use `xxd -r` to reconstruct the actual 50-byte GolfScript program from the hex dump:
```
0000000: 7e6e 270b 97eb 442f e166 9894 9f00 c63c  ~n'...D/.f.....<
0000010: 8128 73a3 9b55 5065 a9fb f06a 2727 ff16  .(s..UPe...j''..
0000020: 277b 6261 7365 7d2f 2b6e 2f3d 7b39 392b  '{base}/+n/={99+
0000030: 7d25                                     }%
```
The basic trick used to generate this program is simple: I compress the long string literal that makes up most of Quincunx's code by subtracting 99 (the ASCII code of the letter `c`) from the character values, interpreting the resulting values as a number in base 22 (enough to encode the letters up to `x`) and then re-encode the resulting number in base 255 to produce the unprintable byte string that makes up most of the first half of my program. The rest of the program then reverses this process, decoding the string back into something printable.
(Since the lowest letter actually present in the number names is `e`, I could've shortened the byte string further by subtracting 101 from the ASCII codes and using base 20. However, subtracting 101 would've mapped the letter `o` to a newline, which I'm using as the number delimiter because it's conveniently available as the built-in constant `n` in GolfScript. Working around that would cost me more than the one byte that using a lower base would save. Using the offset 99 leaves the newline corresponding to the letter `m`, which is conveniently absent from the number names.)
Here's a de-golfed version of the program:
```
~       # eval the input, turning it into a number
n       # push a newline onto the stack; we'll need it later
# this is the byte string encoding the number names:
"\x0B\x97\xEBD/\xE1f\x98\x94\x9F\x00\xC6<\x81(s\xA3\x9BUPe\xA9\xFB\xF0j"
# convert the encoded string from base 255 to base 22
# (and, incidentally, from a string to an array):
"\xFF\x16" {base}/
+       # prepend the newline pushed earlier to the array, re-stringifying it
n/      # split the resulting string at newlines
=       # pick the substring corresponding to the input number
{99+}%  # add 99 to the character values in the chosen substring
```
]