loops/num2words
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
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.