login
The limit of the string "0, 1" under the operation 'repeat string twice and append 0'.
3

%I #22 May 25 2015 08:07:05

%S 0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,

%T 0,1,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,

%U 0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0

%N The limit of the string "0, 1" under the operation 'repeat string twice and append 0'.

%C Start of the first occurrence of k consecutive zeros: A123720 except the first term.

%C The limit of the string "0, 1" under the operation 'repeat string twice and append 1': 0 followed by b(n)=1-a(n+1).

%C Sum of the first 10^n terms c(n) begins: 0, 4, 34, 335, 3335, 33336, 333336, 3333338, 33333338, 333333339, 3333333339.

%e 01 -> 01010 -> 01010010100 -> 01010010100010100101000 etc.

%t rst[ll_] := Flatten[ll /. {x__ -> {x, x, 0}}]; Nest[rst[#] &, {0, 1}, 5] (* _Harvey P. Dale_, May 25 2015 *)

%o (Python)

%o TOP = 10000

%o a = [0]*TOP

%o b = [0]*TOP

%o a[1] = b[1] = 1

%o n = 2

%o while n*2+1<TOP:

%o a[n:] = a[:n]

%o a.append(0)

%o b[n:] = b[:n]

%o b.append(1)

%o n += n+1

%o for i in range(n-1):

%o print a[i],

%o if b[i]!= 1 - a[i+1]:

%o print 'error!'

%o break

%o (Perl)

%o my $A = "01";

%o for (my $j = 1; $j < 10; $j++) { $A .= $A . "0"; } print join(',', split(//,$A)) . "\n";

%o # _Joerg Arndt_, Aug 15 2012

%Y Cf. A164349.

%K nonn,easy

%O 0

%A _Alex Ratushnyak_, Aug 15 2012