A mammoth counting!
Let \(f(n)\) represent the total number of straight line segments in the UPPER CASE English representation of the natural number \(n\) 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 \(f(n) = 18\).
Call a number truthful if \(f(n) = n\). What is the sum of the all truthful numbers from 1 to 9999?
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