Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A006345
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A006345 Linus sequence: a(n) "breaks the pattern" by avoiding the longest doubled suffix.
(Formerly M0074)
+0
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; listen)
OFFSET

1,2

COMMENT

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.

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.

PROGRAM

(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: A051287 A049705 A060236 this_sequence A122497 A154402 A023396

Adjacent sequences: A006342 A006343 A006344 this_sequence 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

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 25 20:09 EST 2009. Contains 167514 sequences.


AT&T Labs Research