Linus and Sally sequences A006345 and A006346

These sequences were invented by Nathaniel Hellerstein (personal communication) after seeing this Linus cartoon.

In A006345, a(n+1) is chosen so as to avoid repeating the longest possible substring of a(1) ... a(n). (This differs slightly from Linus's sequence in the cartoon.)

The Sally sequence, A006346, gives the length of the run that was avoided.

Linus cartoon

This cartoon is copyright 1968 by United Feature Syndicate, Inc., and is reproduced with permission.