5
Inspired by this question.
Champernowne's constant is an infinite decimal number that consists of "0." followed by all natural numbers concatenated together. It begins like so: 0.123456781011121314151617181920212223242526272829303132333435363738394041424344454647484950
, etc. The digits of Chamernowne's constant are sequence A033307 in the OEIS.
Your Task:
Write a program or function that, when given an integer as input, outputs/returns Champernowne's constant up to the first occurance of the input. For example, if the input is 13
, you should output 0.12345678910111213
. If you wish, for inputs greater than 0, you may drop the leading "0." in your output.
Input:
An integer, or a string containing only numbers.
Output:
Champernowne's constant up to the first occurance of the input.
Test Cases:
0 -> 0
1 -> 0.1 OR 1
14 -> 0.1234567891011121314 OR 1234567891011121314
91 -> 0.1234567891 OR 1234567891
12 -> 0.12 OR 12
101 -> 0.123456789101 OR 123456789101
Scoring:
This is code-golf, lowest score in bytes wins!
1Very related. – ETHproductions – 2017-08-03T23:57:30.460
@ETHproductions, thanks, I hadn't seen that. It is very closely related, but I don't think it is quite close enough to qualify as a dupe. However, if you disagree, feel free to CV. – Gryphon – 2017-08-03T23:58:50.213
1@ETHproductions I can't believe I'm getting to the point where I'm forgetting about questions that I actually answered. Anyway to me that seems like a dupe, so I'll close this for now. – FryAmTheEggman – 2017-08-04T00:01:43.630