login
A283131
A different representation (1 mapped to 1, 2 mapped to -1) of the Linus sequence (A006345): a(n) "breaks the pattern" by avoiding the longest doubled suffix.
5
1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1
OFFSET
1
COMMENTS
Sequence of forward or backward steps of a walker/dancer who wants to avoid as much as possible repeating his/her step pattern. To find a(n), consider either a 1 (step forward) or a -1 (step backward). For each, find the longest repeated suffix, that is, for each of a(n) = 1, -1, find the longest sequence s (of steps) with the property that the sequence a(1), ..., a(n) ends with ss. Use the digit that results in the shorter such suffix. a(1) = 1. The empty sequence of length 0 is the shortest possible suffix and is trivially doubled. Note that this doesn't result in exactly Linus's choices. (See comment from K. Ramsey, kramsey(AT)aol.com on A006345.)
There appears to be (on average) slightly more 1 (forward steps) than -1 (backward steps): the partial sums (A283144) keep slowly increasing (as a global trend), though non-monotically.
On average, it seems that (# of 1s up to n) - (# of -1s up to n) -> infinity as n -> infinity (as O(log n)?). - Daniel Forgues, Apr 10 2017
LINKS
FORMULA
a(n) = 3 - 2*A006345(n) = 1 - 2*A157238(n).
MATHEMATICA
a[1] = 1; a[2] = -1; suffix[lst_] := If[MatchQ[lst, {___, b__, b__}], lst /. {___, b__, b__} :> {b}, {}]; a[n_] := a[n] = Module[{aa, lg1, lg2}, aa = Array[a, n - 1]; lg1 = suffix[Append[aa, 1]] // Length; lg2 = suffix[Append[aa, -1]] // Length; If[lg1 <= lg2, 1, -1]]; Array[a, 105] (* Robert G. Wilson v, Mar 19 2017 after Jean-François Alcover in A006345 *)
CROSSREFS
Cf. A006345, A157238, A283144 (partial sums).
Sequence in context: A077008 A158387 A265643 * A008836 A087960 A164660
KEYWORD
sign
AUTHOR
Daniel Forgues, Mar 01 2017
STATUS
approved