-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
31 lines (21 loc) · 958 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
A solution to the number-to-words problem presented at ITA:
http://www.itasoftware.com/careers/puzzle_archive.html
and rekindled by Nathan Wong:
http://nathan.ca/2011/12/ita-word-numbers/
All the integers between 1, and 999,999,999 are spelled out as
words and then sorted alphabetically into a list. Letters are
counted from the start of the list and the integer that completes
just as 51 billion letters have been scanned, is printed out.
A typical run on a 1.6Ghz machine is very quick:
$ time ./solve
Final Integer: 676746575
Written as: sixhundredseventysixmillionsevenhundredfortysixthousandfivehundredseventyfive
Integer Sum: 413540008163475743
Character Count: 51000000000
Number of integers: 723302492
real 0m0.004s
user 0m0.003s
sys 0m0.001s
A program (gen.c) is also included that was used to generate the "data.h"
source file which contains the tables used to iterate through the sorted
number-words.