login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A333325 Lexicographically earliest sequence over {0,1,2} that has the shortest square subsequence. 2

%I #21 Nov 29 2020 12:46:01

%S 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 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 0,1,2,0,2,2,0,1,0,2,0,1,2

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

%C This is very similar to A333307. See that sequence for details about the precise definition. - _N. J. A. Sloane_, Nov 29 2020

%e a(7) = 0, since:

%e 0 yields a square subsequence of length 2: [0, 0],

%e 1 of length 4: [0, 1, 0, 1],

%e 2 of length 8: [0, 1, 0, 2, 0, 1, 0, 2].

%o (Python)

%o def a333325(n):

%o seq = []

%o for k in range(n):

%o options = []

%o l = len(seq) + 1

%o for m in range(3): # base

%o for i in range(l // 2, -1, -1):

%o if seq[l - 2 * i: l - i] == seq[l - i:] + [m]: break

%o options.append(2 * i)

%o seq.append(options.index(min(options)))

%o return seq

%o print(a333325(81))

%Y Cf. A006345, A157238, A283131, A007814.

%K nonn

%O 0,4

%A _Jan Koornstra_, Mar 15 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 01:01 EDT 2024. Contains 371696 sequences. (Running on oeis4.)