%I #48 Nov 11 2019 00:05:08
%S 1,2,3,4,5,6,7,8,9,1,0,1,1,1,3,1,4,1,5,1,6,1,7,1,8,1,9,2,0,2,1,2,2,2,
%T 4,2,5,2,6,2,7,2,8,2,9,3,0,3,2,3,3,3,5,3,6,3,7,3,8,3,9,4,0,4,3,4,4,4,
%U 6,4,7,4,8,4,9,5,0,5,4,5,5,5,7,5,8,5,9,6,0,6,5,6,6,6,8,6,9,7,0,7,6,7,7,7,9,8,0,8,7,8,8,9,0,9,9,1,0,0,1,0,2,1,0,3,1,0,4,1,0,5,1,0,6,1,0,7,1,0,8,1,0,9,1,1,0,1,1,2,1,1,4,1,1,5,1,1,6,1,1,7,1,1,8,1,1,9,1,2,0,1,2,4,1,2,5,1,2,6,1,2,7,1,2,8,1
%N Decimal expansion of the reduced Champernowne constant.
%C The Champernowne constant is 0.123456789101112131415161718192021222324... (all integers concatenated). Every integer can be found in the base 10 representation of this number.
%C Compare that to the reduced Champernowne constant, which is 0.12345678910111314151617181920212224... The decimal part is the concatenation of each successive integer if it is not already present in the sequence. By construction, the decimal expansion of this number also contains every integer.
%C Let's call C(k) the index of the beginning of k in the Champernowne constant and RC(k) the position index of the same integer in the reduced Champernowne constant.
%C Examples :
%C C(3) = 2 (0.123...) C(10) = 9 (0.12345678910) C(13) = 15 (0.12345678910111213) ...
%C RC(3) = 2 (0.123...) RC(10) = 9 (0.12345678910) RC(13) = 13 (0.123456789101113) ...
%C "Most" of the time RC(k) <= C(k).
%C The smallest k for which C(k) > RC(k) is 21:
%C Champernowne: 0.1234567891011121...
%C Reduced Champernowne: 0.1234567891011131415161718192021...
%C Values of k smaller than 500 for which C(k) > RC(k) are 21, 32, 43, 112, 121, 132, 142, 152, 162, 172, 182, 213, 221, 223, 231, 232, 243, 253, 263, 273, 283, 311, 312, 313, 324, 332, 334, 342, 343, 354, 364, 374, 384, 414, 422, 423, 424, 435, 445, 454, 465, 475, 485.
%C For each n, what is the percentage P(n) of k <= n such that C(k) > RC(k) ?
%C For all n between 20000 and 50000, 9.5% < P(n) < 10.3%.
%H Laurent Signac, <a href="/A189823/b189823.txt">Table of n, a(n) for n = 0..10609</a>
%H Laurent Signac, <a href="http://blogs.univ-poitiers.fr/laurentsignac/2012/01/06/nombre-univers/">Nombre Univers</a>
%e 0.1234567891011... At this point in the Champernowne constant, we would append 12. But since "12" already occurred at the very beginning, for the reduced Champernowne constant, we move on to 13.
%e 0.123456789101113141516171819202122... We don't append 23 because "23" already occurred (close to the beginning).
%e 0.12345678910111314151617181920212224252627282930... We don't append 31 because "31" already occurred (from the concatenation of 13 and 14).
%t redChamp = IntegerDigits[123456789]; For[n = 10, n < 500, n++, digits = IntegerDigits[n];redChamp = Flatten[Append[redChamp, If[SequencePosition[redChamp, digits] == {}, digits, {}]]]]; redChamp (* _Alonso del Arte_, Sep 29 2019 *)
%o (Python)
%o def rchampernowne(n):
%o ....stri=''
%o ....for i in range(1,n+1) :
%o ........if stri.count(str(i))==0 : stri=stri+str(i)
%o ....return '0.'+stri+'...'
%o rchampernowne(100) # computes the decimal representation of the reduced Champernowne number until step 100 is reached. The computation of rchampernowne(n) ends when step n is reached, not when n appears in the decimal representation.
%o (Scala) var numerStr = ""
%o for (n <- 1 to 100) if (numerStr.indexOf(n.toString) == -1) numerStr = numerStr + n.toString
%o numerStr.split("").map(Integer.parseInt(_)).toList // _Alonso del Arte_, Nov 04 2019
%Y Cf. A033307, A325479 (similar but more compact).
%K nonn,base,cons
%O 0,2
%A _Laurent Signac_, May 18 2011