OFFSET
0,6
COMMENTS
After a 0 there is the number of 0 so far minus 1. - David A. Corneth, May 15 2026
EXAMPLE
a(0) = 0, because it is the earliest nonnegative term.
a(1) = 0, because difference |a(n)-a(n+1)| is minimal.
a(2) = 1, because for 0,0,0 the subsequence "0,0" already appeared.
a(3) = 1, because difference |a(n)-a(n+1)| is minimal.
a(4) = 0, because 1,1 already appeared and |a(n)-a(n+1)| is minimal and lexicographically earliest value.
PROG
(Python)
def generate_sequence(n):
seq = [0]
seen_pairs = set()
for _ in range(n):
current = seq[-1]
d = 0
while True:
if current - d >= 0 and (current, current - d) not in seen_pairs:
next_term = current - d
break
if current + d >= 0 and (current, current + d) not in seen_pairs:
next_term = current + d
break
d += 1
seen_pairs.add((current, next_term))
seq.append(next_term)
return seq
print(generate_sequence(90))
CROSSREFS
KEYWORD
nonn
AUTHOR
Marc Morgenegg, May 11 2026
STATUS
approved
