# Create a program that prints the number of characters it has, in words

Create a program which prints the amount of characters its source has in English words.

If your program is nine letters long it should print "nine".

Capitalization is ignored: in case you're printing "one" (somehow) you can print "one", "oNe", "ONE" or anything else.

Base ten is required.

Proper spacing is also required.

In the (unlikely but just for specification) case your program reaches one billion characters or more, use the American number scale. A billion here is 10^9 and a million is 10^6.

Do not use "one hundred and one": use "one hundred one".

Do not use the hyphen. Print forty four, not forty-four.

Test cases with a fake program:

10.(96 0s later)..01 prints one HuNdreD ONE -- okay: proper spacing, no "and"
10.(96 0s later)..01 prints one HuNdreDONE -- not okay: wrong spacing
10.(96 0s later)..01 prints one thousand two hundred two -- not okay: base 3 rather than base 10
10...(999999996 0s later) prints nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-six: not okay, wrong number and includes hyphens


Golfy challenge, as always: shortest code wins. You're free to post after the green tick has been given, though. This serves more for completeness for hard to program languages. Malbolge, anyone?

• Proper spacing is also required. Does this mean no trailing spaces in the output? – Engineer Toast Oct 23 at 12:14

# R, 7 6 bytes

 "six" #space before the text


Previously:

"seven"

• Also works in PHP without the opening PHP tag. In fact, with PHP you could have simply four – Shaun Bebbers Oct 21 at 13:53

# Hexagony, 9 bytes

n;i;@;e\\


Try it online!

I'm slightly disappointed that I couldn't get six to work (that would be pushing it with three characters, one output, one redirection and one termination).

## NotHow it works

This Hexagony program looks almost like normal code!

n;i;@;e\\
n;i;       Pushes n and prints it, then pushes i and prints it
@;     Retrieves the bottom of the stack (n) and prints it
e\\  Pushes e and terminates the program, printing implicitly


## How it works

Input starts on the blue path, storing the value n then printing it with ;. It picks up the value i, then jumps to the third line where it hits a mirror. This takes it to the diagonal path, reentering the value i then printing it with ;.

From the bottom left corner, since the current value of i is truthy, it jumps to the red stream starting in the top-left corner, taking n then printing it with ;. The two mirrors redirect it and then it jumps to the e. Finally, it jumps from the middle of the bottom edge to the middle of the top edge, printing the e with ; and terminating with @.

Thanks to Timwi for their HexagonyColorer.

# Ruby, 6 bytes

Ruby has an extremely convenient builtin p that prints the string.

p'six'


Try it online!

• Are the quotes allowed? – Eric Duminil Oct 20 at 7:00

# Red, 10 bytes

print 'ten


Try it online!

# Japt, 5 bytes

"five


Try it online!

• Welcome to Japt :) I'll be reopening my bounty (with slightly lower rep) for new users on Monday or Tuesday if you'd like to try for it. I'll count any solutions you post between now and then towards it, including this one. You're welcome to my solution, if you'd like; didn't see yours before posting. – Shaggy Oct 19 at 22:01
• Thank you @Shaggy ! I'll try it for sure even if I'm scared by the characters used since I do everything from a phone.. Btw I was sure there was some compression available in Japt, my bad I didn't checked. – AZTECCO Oct 20 at 8:22
• This also works in TI-Basic (with all caps) "FIVE – pizzapants184 Oct 20 at 21:31

# Zsh, 6 bytes

<<<six


Try it online!

# C (gcc), 25 20 bytes

f(){puts("twenty");}

• "twenty" works – 12Me21 Oct 19 at 21:19
• @12Me21 I am a fool. – GammaFunction Oct 19 at 22:08

# Backhand, 6 bytes

"s"xiH


Try it online!

Outputs "six".

# R, 10 bytes

cat("ten")


Try it online!

Prints ten. This simple answer is much shorter than all the other options I could think of.

If a bit of fluff around the answer is allowed, we can go with

# R, 6 bytes

"six";


Try it online!

which prints [1] "six".

If a lot of fluff is allowed, we could even go with

# R, 4 bytes

four


Try it online!

which prints to STDERR Error: object 'four' not found.

# Brain-Flak, 80 bytes

((((((((()()()())))((({({}){}}()){}){}()))[[]])())[][][])[]){({}<>)<>}<>........


Try it online!

The code to push eighty is 72 bytes and we add an extra 8 bytes to bring it to the correct amount.

# Brain-Flak, 80 bytes

(((())()()()())((([]())())[][][])){({}(([]([]<>[])[]{}()){}){})<>}<>............


Try it online!

This version pushes EIGHTY and requires 12 bytes of padding.

# Excel, 4 bytes

four


Uninteresting answer, not using a formula.

### Excel, 5 bytes

'five


Using a formula, requires at least 3 extra bytes (=, ", ").

### Excel, 6 bytes

="six"


### Excel, 12 bytes

="tw"&"elve"
=T("twelve")


### Excel, 14 bytes

=T("fourteen")


### Excel, 16 bytes

=IF(1,"sixteen")


### Excel, 18 bytes and upwards

=TRIM(" % ")


Insert required text, padded with required whitespace.

# cat, 4 bytes

four


There are plenty of literal "four" answers already, but not one written in cat yet.

• Also works in Text – Hello Goodbye Nov 18 at 14:54

# Whitespace, 151 60 bytes

[S S S T    T   S N
_Push_6_Y][S S S T  N
_Push_1_T][S S S T  S T N
_Push_5_X][S S T    T   S T S N
_Push_-10_I][S S S S S N
S S N
_Create_Label_LOOP][S S S T S T S S T   T   N
_Push_constant_83][T    S S S _Add_top_two][T   N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP]


Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Whopping -91 bytes thanks to @JoKing by using an < instead of == check in my Java program below and adding no-ops.

Shortest program generated with this Java program, which uses the printing approach of this Whitespace tip to output in full uppercase.

# Turing Machine Code, 60 50 bytes

0 _ f r 1
1 _ i r 2
2 _ f r 3
3 _ t r 4
4 _ y r 50


Try it online!

As an added bonus, if that counts for anything, it has the number in the code as well. Edit: Found a shorter solution which still contains the number of bytes in the code.

• It doesn't count but nice stuff. – Andrew Oct 19 at 17:29

# Hexagony, 6 bytes, 17 cycles

s;i>x@


Try it online!

Now the letters six are in more natural order, and the program finishes one cycle faster.

### How it works

For more thorough explanation, see the previous answer below.

 A B
C > D
E .
^^  ^^    ^^    ^
s;  i;    x;    @


# Hexagony, 6 bytes, 18 cycles

x>i;s@


Try it online!

Inspired by boboquack's 9-byte solution. The following quote was a big hint:

I'm slightly disappointed that I couldn't get six to work (that would be pushing it with three characters, one output, one redirection and one termination).

### How it works (or, How I got to this solution)

A 6-byte program is laid out on a hexagon of side length 2, and the 7th instruction is necessarily a no-op:

 ? ?
? ? ?
? .


Since I needed at least one mirror, I tried out various mirrors placed at various places, until I found this:

 A >
B C D
E .


Assuming the current memory is always positive (and there are no branches/mirrors/IP changers among ABCDE), the IP follows the path

A>ADCB>.CAD>DAC.BE


The cell C is run exactly three times, and the cells right before C are D, B, and A respectively. And the cell E is first run after three runs of C. This is exactly what we want: write one of s, i, or x on the memory and print it, and then terminate!

Now back to the actual source code:

 x >
i ; s
@ .


And the execution path, linearized, with significant instructions emphasized:

x>xs;i>.;xs>sx;.i@
^^^  ^    ^^  ^
^^              Print 's'
^  ^          Print 'i'
^^    Print 'x'
^ Terminate


# APL (Dyalog Unicode), 129 6 bytes

Took me a little searching and I don't like requiring the extra spaces, but such are the vagaries of English numbers.

Edit: -3 bytes thanks to Night2. -3 bytes thanks to ngn.

⊢'six'


Try it online! And a slightly different version to get it to work on Try it online!

• is ⎕← required? dyalog prints results by default. if not: ⊢'six' – ngn Nov 18 at 0:35
• @ngn Not in TIO tio.run/##SyzI0U2pTMzJT////1HXIvXizAr1//8B – Sherlock9 Nov 18 at 5:50
• but. or. generally, in kolmogorov complexity challenges we don't add ⎕←. – ngn Nov 18 at 11:25
• @ngn In that case, I've added both. – Sherlock9 Nov 18 at 13:08

# Python 2, 10 bytes

print'ten'


Try it online!

# Lua, 16 bytes

print('sixteen')


Try it online!

# Retina 0.8.2, 5 bytes


five


Try it online! Simply substitutes the empty input with the word five, which is the first word to have one fewer letter than its value.

# BASIC, 6 bytes

?"SIX"


(Specifically tested in SmileBASIC: should work in most dialects, though ? is often expanded to PRINT, I think it's usually still stored as one byte)

"
n
i
n
e


Try it online!

# Scheme, 5 bytes

This works in any Scheme implementation, but Chicken Scheme is what I used.

'five

## EDIT: Alternative 4-byte solution

four outputs this:

Error: unbound variable: four

I think this counts, but if you don't like errors, the above solution is for you.

# bit**, 30 bytes

#116/#104/#105/#114/#116/#121/


Try it online!

# PowerShell, 6 bytes

Note the space before the first quotation mark.

 "six"


Try it online!

# Ruby, 9 bytes

puts:nine


Try it online!

Longer than the other answer, but does not output extra characters

# Ceylon (Web IDE), 18 bytes

The Ceylon Web IDE allows to omit all the boilerplate which makes up a normal program, so we can use just the actual print statement:

print("eighteen");


Try it online!

# Ceylon (with run function), 30 bytes

void run() { print("thirty");}


Try it online!

# Commodore BASIC (TheC64/Mini, C64/128, VIC-20, PET, C16/+4) 25 tokenised and BASIC bytes

 0 print"seventeen


I could use the abbreviated ? but when listed the program will show the full print keyword. In any case it would make no difference to the byte count as ? and print use the same number of BASIC tokens.

# Perl 5, 9 bytes

say"nine"


Try it online!

# Cubix, 20 bytes

/o;."uytnewT.p^@!<..


Try it online!

This wraps onto the cube as follows

    / o
; .
" u y t n e w T
. p ^ @ ! < . .
. .
. .


Watch it run

• "uytnewT open string and start pushing uytnewT onto the stack
• "u close the string and u-turn onto the lower line
• p bring the bottom of the stack to the top
• <! beginning of the print loop and test for 0
• @ halt if tested 0
• ^y;/oe redirect up, no-op, pop TOS, reflect right, output character, no-op and then onto the beginning of the print loop

Erlang, 5 bytes

five.


Enter this code at interpreter prompt.