Let represent the total number of straight line segments in the UPPER CASE English representation of the natural number without adding AND and hyphen ( - ). For example, 12 can be written as TWELVE and if you carefully count all the straight-line segments in it, you get .
Call a number truthful if . What is the sum of the all truthful numbers from 1 to 9999?
Explicit Examples :
The letters G , I , J , Q , R , U and X contain 1, 1, 0, 1, 2, 0 and 2 straight line segments respectively.
Use the word ONE for denoting a single hundred or thousand and don't use the word AND anywhere.
Some examples of the upper representation are:
73: SEVENTY THREE
105: ONE HUNDRED FIVE
1274: ONE THOUSAND TWO HUNDREDS SEVENTY FOUR
6001: SIX THOUSANDS ONE
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The main idea is to identify few numbers whose representations cannot be created using representations of other numbers. After a little thought, it is easy to see that only such numbers below 1 0 0 0 0 are 1 to 2 0 , 3 0 , 4 0 , 5 0 , 6 0 , 7 0 , 8 0 , 9 0 , 1 0 0 , 1 0 0 0 . For our problem, HUNDRED and HUNDREDS are same since the last S does not contribute anything. Below is the python function which returns the upper case English representation of a given natural number. After that, finding the actual truthful numbers is quite easy. There are only two: 1 6 and 2 9 . Hence the answer is 4 5 .