login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006345 Linus sequence: a(n) "breaks the pattern" by avoiding the longest doubled suffix.
(Formerly M0074)
3
1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2 (list; graph; refs; listen; history; internal format)
OFFSET

1,2

COMMENTS

To compute a(n), consider either a 1 or a 2. For each, find the longest repeated suffix, that is, for each of a(n)=1,2, find the longest sequence s 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 (K. Ramsey, kramsey(AT)aol.com).

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, Table of n, a(n) for n=1..1000

N. J. A. Sloane, Illustration of initial terms

Eric Weisstein's World of Mathematics, Link to a section of The World of Mathematics.

EXAMPLE

After 1,2,1,1,2,2,1,2, if we put a 1, the suffix {2,1} repeats, but if we put a 2 the longer suffix {1,2,2} repeats, so the next term is 1.

PROG

(Perl) -le 'print$_.=3**/(.*)(.)\1$/-$2for($_)x99' (Ton Hospel/Phil Carmody) [An example of Perl golfing: use as few (key)strokes as possible]

(PARI) {a(n)=local(A, t); if(n<2, n>0, A=[1]; for(i=2, n, forstep(j=i\2-1, 0, -1, for(k=1, j, if(A[i-j-k-1]!=A[i-k], next(2))); t=j; break); A=concat(A, [3-A[i-t-1]])); A[n])} /* Michael Somos May 04 2006 */

CROSSREFS

Cf. A006346.

Sequence in context: A202340 A049705 A060236 * A122497 A154402 A177025

Adjacent sequences:  A006342 A006343 A006344 * A006346 A006347 A006348

KEYWORD

nonn,easy,nice

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com).

EXTENSIONS

More terms from Naohiro Nomoto (6284968128(AT)geocities.co.jp), May 21 2001

Additional comments from Mitch Harris, Dec 31, 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 13 06:29 EST 2012. Contains 205444 sequences.