Revision d9c20a8f-a6b1-4d0e-9bc9-64a129416c6c - Code Golf Stack Exchange
###Introduction
In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: `0.1234567891011121314151617...` and so on.
You can see that the first appearence of `15` starts at the `20th` decimal:
Position
0000000001111111111222222222233333333334444444444555555555566666666
1234567890123456789012345678901234567890123456789012345678901234567
^
0.1234567891011121314151617181920212223242526272829303132333435363738...
^^
15 = position 20
The first appearence of `45` starts at the `4th` decimal:
Position
0000000001111111111222222222233333333334444444444555555555566666666
1234567890123456789012345678901234567890123456789012345678901234567
^
0.1234567891011121314151617181920212223242526272829303132333435363738...
^^
45 = position 4
So, the task is easy. Given a non-negative integer, output the position of the integer in the Champernowne constant.
###Rules
- You may provide a function or a program
- This is [tag:code-golf], so the submission with the least amount of bytes wins!
###Test cases
Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48