I am trying to figure out the mathematical relation between a number and the number of digits that number has.
For e.g. Relation between 0, 1, 2...9 and 1,
or between 10, 11, 12...99 and 2, or between 100, 101, 102...999 and 3, or between 1000, 1001,...5000, 5001, ...9999 and 4.
So given a number having 'n' digits whose value is 'x', I want to express it as
n = f(x)
I could figure out the following:
x = ∑(10^i * xi) where i=1 to n. Where xi is the digit at position i.
So x = x1 + 10*x2 + 10^2*x3 + ... + 10^n*xn
Where x1, x2, x3 etc. are digits at unit, tenth, hundredth positions respectively.
I am surely missing something here. Any help is appreciated
Thanks,
Sid