login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A356677
The lexicographically earliest infinite squarefree sequence of nonnegative integers that starts with 1.
7
1, 0, 1, 2, 0, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 0, 2, 0, 1, 2, 0, 3, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 3, 0, 1, 0, 3, 0, 2, 0, 1, 0, 2, 0, 3, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 3, 0, 1, 0, 3, 0, 2, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 3, 0, 1, 0
OFFSET
1,4
COMMENTS
Conjecture: For any integer k>2, prepending a k at the beginning of this sequence gives the corresponding least word beginning k,1.
After the first 5177 letters, this becomes the sequence A356676.
LINKS
Siddharth Berera, Andrés Gómez-Colunga, Joey Lakerdas-Gayle, John López, Mauditra Matin, Daniel Roebuck, Eric Rowland, Noam Scully, and Juliet Whidden, The lexicographically least square-free word with a given prefix, arXiv:2210.00508 [math.CO], 2022.
PROG
(Python)
# check if appending letter to the end of word introduces a square
def makes_square(word, letter):
new_word = word+[letter]
for l in range(1, len(new_word) // 2 + 1):
if new_word[-l:] == new_word[-2*l:-l]:
return True
return False
# returns a list of the first n letters of L(word)
def build_square_free(word, n):
new_word = word[:]
for i in range(n-len(word)):
next_letter = 0
while makes_square(new_word, next_letter):
next_letter += 1
new_word += [next_letter]
return new_word
# returns a list of the first n terms of A356677
def A356677_list(n):
return build_square_free([1], n)
(Python) # See link to more efficient algorithm
CROSSREFS
Cf. A356676 (suffix).
Other word starts: A007814 (w=0), this sequence (w=1), A356678 (w=2), A356679 (w=3), A356680 (w=1,2), A356681 (w=1,3), A356682 (w=2,1).
Sequence in context: A129688 A356678 A356680 * A309011 A365921 A086713
KEYWORD
nonn
AUTHOR
Joey Lakerdas-Gayle, Aug 22 2022
EXTENSIONS
Name edited by N. J. A. Sloane, Nov 26 2022
STATUS
approved