cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A006346 The Sally sequence: the length of repetition avoided in A006345.

This page as a plain text file.
%I A006346 M0126 #53 Feb 16 2025 08:32:30
%S A006346 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,
%T A006346 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,
%U A006346 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
%N A006346 The Sally sequence: the length of repetition avoided in A006345.
%C A006346 In the first 1000 terms, only patterns of lengths 0, 1, 2, 3, 4, 6, 8, 24, 30 and 108 are avoided. - _T. D. Noe_, Oct 14 2006
%C A006346 In the first 20000 terms, patterns of lengths 0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 18, 24, 30, 108, 528, 552, 1298, 2752, 5876 are avoided. - _Robert Israel_, Jun 22 2015
%C A006346 In the first 10^6 terms, patterns of lengths 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 24, 30, 36, 60, 72, 108, 318, 372, 414, 420, 444, 522, 528, 546, 552, 1280, 1292, 1298, 1632, 2620, 2752, 5876, 6203, 6218, 13912, 14312, 17220, 17580, 31532, 87650 are avoided. - _Ray Chandler_, Jun 24 2015
%D A006346 N. S. Hellerstein, personal communication to _N. J. A. Sloane_.
%D A006346 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A006346 T. D. Noe, Robert Israel and Hugo van der Sanden, <a href="/A006346/b006346.txt">Table of n, a(n) for n = 1..50000</a> (1..1000 from T. D. Noe, 1001..20000 from Robert Israel)
%H A006346 N. Hellerstein, <a href="/A006345/a006345.pdf">Letter to N. J. A. Sloane, 1978</a>
%H A006346 N. Hellerstein, M. Gardner, & S. Kim, <a href="/A006345/a006345_1.pdf">Correspondence related to the Linus and Sally sequences, 1977</a>
%H A006346 N. J. A. Sloane, <a href="/A006345/a006345.html">Illustration of initial terms</a>
%H A006346 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SallySequence.html">Sally Sequence.</a>
%p A006346 LDS:= proc(L)
%p A006346   local Cands, r, m;
%p A006346   Cands:= {$1..floor(nops(L)/2)};
%p A006346   r:= 0;
%p A006346   for m from 1 while nops(Cands) > 0 do
%p A006346      Cands:= select(c -> L[-m] = L[-c-m], Cands);
%p A006346      if min(Cands) = m then
%p A006346         r:= m;
%p A006346         Cands:= subs(m=NULL,Cands);
%p A006346      fi
%p A006346    od;
%p A006346    r
%p A006346 end proc:
%p A006346 A:= 1: B:= 0;
%p A006346 for n from 2 to 1000 do
%p A006346   a1:= LDS([A,1]);
%p A006346   a2:= LDS([A,2]);
%p A006346   if a1 < a2 then A:= A,1; B:= B, a2 else A:= A,2; B:= B, a1 fi;
%p A006346 od:
%p A006346 seq(B[i],i=1..1000); # _Robert Israel_, Jun 22 2015
%t A006346 max = 120;
%t A006346 LDS[L_] := Module[{Cands, r, m},
%t A006346   Cands = Range[Floor[Length[L]/2]];
%t A006346   r = 0;
%t A006346   For[m = 1, Length[Cands] > 0, m++,
%t A006346     Cands = Select[Cands, L[[-m]] == L[[-#-m]]&];
%t A006346     If[Min[Cands] == m, r = m;
%t A006346     Cands = ReplaceAll[Cands, m -> Nothing]]
%t A006346   ];
%t A006346 r];
%t A006346 A = {1}; B = {0};
%t A006346 For[n = 2, n <= max, n++,
%t A006346   a1 = LDS[Append[A, 1]];
%t A006346   a2 = LDS[Append[A, 2]];
%t A006346   If[a1 < a2,
%t A006346     AppendTo[A, 1]; AppendTo[B, a2],
%t A006346     AppendTo[A, 2]; AppendTo[B, a1]
%t A006346   ]
%t A006346 ];
%t A006346 Table[B[[i]], {i, 1, max}] (* _Jean-François Alcover_, Jun 08 2018, after _Robert Israel_'s Maple program *)
%Y A006346 Cf. A006345.
%K A006346 nonn,nice,easy,look
%O A006346 1,4
%A A006346 _N. J. A. Sloane_
%E A006346 More terms from _Naohiro Nomoto_, May 21 2001