login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A094293 At the n-th step, append the number n and n copies of the list of all preceding terms, starting with an empty list. 2
1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 4, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 5, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(1)= 1, a(2) = 2. Let the index of first occurrence of n be k=A094294(n). Then from a(k+1) onwards the next n*(k-1) terms are the first (k-1) terms repeated n times, a(k+1) = a(1), a(k+2) = a(2) etc.
Let r be the index of the first occurrence of n-1 then the index of first occurrence of n is r+(n-1)*(r-1)+1 = (n+1)*r-n+2, cf. A094294. [Corrected by M. F. Hasler, Apr 09 2009]
LINKS
EXAMPLE
a(5) = 3 and the first four terms are 1,2,1,1. hence the next 12 terms are 1,2,1,1,1,2,1,1,1,2,1,1 and a(18) = 4 (the first occurrence) and so on.
(Contribution by M. F. Hasler, start:) The sequence is created as follows:
First step: append 1 to the empty list: result = [1].
2nd step: append 2 and two copies of the previous result, to get [1,2,1,1].
3rd step: append 3 and three copies of [1,2,1,1], to get [1,2,1,1, 3, 1,2,1,1, 1,2,1,1, 1,2,1,1].
PROG
(PARI) A094293(n, a=[])={ for(k=1, 1+n--, n<=(k+1)*#a & return(if(n>#a, a[1+(n-1)%#a], k)); a=concat(vector(k+2, j, if(j==2, [k], a))))} \\ M. F. Hasler, Apr 09 2009
CROSSREFS
Cf. A001511.
Sequence in context: A342723 A164659 A057898 * A338156 A335122 A334442
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Apr 28 2004
EXTENSIONS
Edited & corrected by M. F. Hasler, Apr 10 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 07:57 EDT 2024. Contains 371905 sequences. (Running on oeis4.)