Project Euler / 17

Problem 17 asks:

If all the numbers from 1 to 1‚ÄČ000 (one thousand) inclusive were written out in words, how many letters would be used?

This problem can be solved by hand. I essentially used Python as a calculator to solve it:

len("onethousand" + 900*"hundred" + 190*"onetwothreefourfivesixseveneightnine" +
    100*"twentythirtyfortyfiftysixtyseventyeightyninety" + 891*"and" +
    10*"teneleventwelvethirteenfourteenfifteensixteenseventeeneighteennineteen")

Last updated on .