Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting numbers from 1 to 999,999,999 in words as strings
    primarykey
    data
    text
    <p>Interesting <a href="http://www.itasoftware.com/careers/puzzles07.html" rel="noreferrer">programming puzzle</a>:</p> <blockquote> <p>If the integers from 1 to 999,999,999 are written as words, sorted alphabetically, and concatenated, what is the 51 billionth letter?</p> <p>To be precise: if the integers from 1 to 999,999,999 are expressed in words (omitting spaces, ‘and’, and punctuation - see note below for format), and sorted alphabetically so that the first six integers are</p> <ul> <li>eight</li> <li>eighteen</li> <li>eighteenmillion</li> <li>eighteenmillioneight</li> <li>eighteenmillioneighteen</li> <li>eighteenmillioneighteenthousand</li> </ul> <p>and the last is</p> <ul> <li>twothousandtwohundredtwo</li> </ul> <p>then reading top to bottom, left to right, the 28th letter completes the spelling of the integer “eighteenmillion”.</p> <p>The 51 billionth letter also completes the spelling of an integer. Which one, and what is the sum of all the integers to that point?</p> <p><em>Note:</em> For example, 911,610,034 is written “ninehundredelevenmillionsixhundredtenthousandthirtyfour”; 500,000,000 is written “fivehundredmillion”; 1,709 is written “onethousandsevenhundrednine”.</p> </blockquote> <p>I stumbled across this on a programming blog <a href="http://gnuvince.wordpress.com/" rel="noreferrer">'Occasionally Sane'</a>, and couldn't think of a neat way of doing it, the author of the <a href="http://gnuvince.wordpress.com/2007/09/19/word-numbers/" rel="noreferrer">relevant post</a> says his initial attempt ate through 1.5GB of memory in 10 minutes, and he'd only made it up to 20,000,000 ("twentymillion").</p> <p>Can anyone <strike>think of</strike> <strike><em>come up with</em></strike> <strong>share with the group</strong> a novel/clever approach to this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload