A006346 The Sally sequence: the length of repetition avoided in A006345.
0, 1, 1, 2, 1, 3, 1, 1, 3, 2, 1, 6, 3, 2, 1, 3, 1, 1, 6, 3, 2, 4, 1, 1, 3, 2, 1, 3, 1, 6, 4, 2, 1, 2, 4, 3, 1, 8, 3, 2, 1, 6, 3, 2, 1, 3, 1, 1, 6, 3, 2, 4, 1, 1, 3, 2, 1, 3, 1, 30, 6, 3, 2, 4, 1, 1, 3, 2, 1, 3, 1, 6, 4, 2, 1, 2, 4, 3, 1, 8, 3, 2, 1, 6, 3, 2, 1, 3, 1, 1, 6, 3, 2, 4, 1, 1, 3, 2, 1, 3, 1, 6, 4, 2
Offset: 1
References
- N. S. Hellerstein, personal communication to N. J. A. Sloane.
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- T. D. Noe, Robert Israel and Hugo van der Sanden, Table of n, a(n) for n = 1..50000 (1..1000 from T. D. Noe, 1001..20000 from Robert Israel)
- N. Hellerstein, Letter to N. J. A. Sloane, 1978
- N. Hellerstein, M. Gardner, & S. Kim, Correspondence related to the Linus and Sally sequences, 1977
- N. J. A. Sloane, Illustration of initial terms
- Eric Weisstein's World of Mathematics, Sally Sequence.
Crossrefs
Cf. A006345.
Programs
-
Maple
LDS:= proc(L) local Cands, r, m; Cands:= {$1..floor(nops(L)/2)}; r:= 0; for m from 1 while nops(Cands) > 0 do Cands:= select(c -> L[-m] = L[-c-m], Cands); if min(Cands) = m then r:= m; Cands:= subs(m=NULL,Cands); fi od; r end proc: A:= 1: B:= 0; for n from 2 to 1000 do a1:= LDS([A,1]); a2:= LDS([A,2]); if a1 < a2 then A:= A,1; B:= B, a2 else A:= A,2; B:= B, a1 fi; od: seq(B[i],i=1..1000); # Robert Israel, Jun 22 2015
-
Mathematica
max = 120; LDS[L_] := Module[{Cands, r, m}, Cands = Range[Floor[Length[L]/2]]; r = 0; For[m = 1, Length[Cands] > 0, m++, Cands = Select[Cands, L[[-m]] == L[[-#-m]]&]; If[Min[Cands] == m, r = m; Cands = ReplaceAll[Cands, m -> Nothing]] ]; r]; A = {1}; B = {0}; For[n = 2, n <= max, n++, a1 = LDS[Append[A, 1]]; a2 = LDS[Append[A, 2]]; If[a1 < a2, AppendTo[A, 1]; AppendTo[B, a2], AppendTo[A, 2]; AppendTo[B, a1] ] ]; Table[B[[i]], {i, 1, max}] (* Jean-François Alcover, Jun 08 2018, after Robert Israel's Maple program *)
Extensions
More terms from Naohiro Nomoto, May 21 2001
Comments