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.

A333325 Lexicographically earliest sequence over {0,1,2} that has the shortest square subsequence.

This page as a plain text file.
%I A333325 #21 Nov 29 2020 12:46:01
%S A333325 0,1,0,2,0,1,0,0,1,2,0,1,0,2,0,1,2,0,2,1,0,1,2,0,1,0,2,0,1,2,0,2,2,0,
%T A333325 1,0,2,0,1,2,0,0,1,0,2,0,1,0,0,1,2,0,1,0,2,0,1,2,0,2,1,0,1,2,0,1,0,2,
%U A333325 0,1,2,0,2,2,0,1,0,2,0,1,2
%N A333325 Lexicographically earliest sequence over {0,1,2} that has the shortest square subsequence.
%C A333325 This is very similar to A333307.  See that sequence for details about the precise definition. - _N. J. A. Sloane_, Nov 29 2020
%e A333325 a(7) = 0, since:
%e A333325 0 yields a square subsequence of length 2: [0, 0],
%e A333325 1 of length 4: [0, 1, 0, 1],
%e A333325 2 of length 8: [0, 1, 0, 2, 0, 1, 0, 2].
%o A333325 (Python)
%o A333325 def a333325(n):
%o A333325   seq = []
%o A333325   for k in range(n):
%o A333325     options = []
%o A333325     l = len(seq) + 1
%o A333325     for m in range(3): # base
%o A333325       for i in range(l // 2, -1, -1):
%o A333325         if seq[l - 2 * i: l - i] == seq[l - i:] + [m]: break
%o A333325       options.append(2 * i)
%o A333325     seq.append(options.index(min(options)))
%o A333325   return seq
%o A333325 print(a333325(81))
%Y A333325 Cf. A006345, A157238, A283131, A007814.
%K A333325 nonn
%O A333325 0,4
%A A333325 _Jan Koornstra_, Mar 15 2020