cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A157238 0-1 sequence generated by starting with a 0, and then by using whichever of 0, 1 will result in the shortest sequence repeated at the end.

This page as a plain text file.
%I A157238 #22 May 19 2021 01:31:36
%S A157238 0,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,
%T A157238 1,1,0,1,0,0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,0,1,1,1,0,0,1,0,1,1,
%U A157238 0,0,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,1,1,1,0,0,1,0,1,1,0,0
%N A157238 0-1 sequence generated by starting with a 0, and then by using whichever of 0, 1 will result in the shortest sequence repeated at the end.
%C A157238 The same as the Linus sequence (A006345): a(n) "breaks the pattern" by avoiding the longest doubled suffix, but using 0's and 1's. - _Robert G. Wilson v_, Dec 01 2013
%F A157238 a(n) = A006345(n) - 1. - _Robert G. Wilson v_, Dec 02 2013
%e A157238 a(6)=1 as 0,1,0,0,1,1 has a longest repeated sequence of length 1 at the end, whereas 0,1,0,0,1,0 has a longest repeated sequence of length 3 at the end. Similarly, a(7)=0 since 0,1,0,0,1,1,0 has a longest repeated sequence of length 0 at the end.
%o A157238 (Python)
%o A157238 x = [0]
%o A157238 while len(x) < 1000:
%o A157238     t = x[-1]
%o A157238     z = 1
%o A157238     while 2 * z + 1 <= len(x):
%o A157238         if x[-z:] == x[-(2 * z + 1) : -(z + 1)]:
%o A157238             t = x[-(z + 1)]
%o A157238         z += 1
%o A157238     x.append(1 - t)
%o A157238 print(x)
%Y A157238 Cf. A006345, A283131.
%K A157238 nonn
%O A157238 1,1
%A A157238 Luke Pebody (luke.pebody(AT)gmail.com), Feb 25 2009