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.
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
Offset: 1
Keywords
Examples
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].
Crossrefs
Cf. A001511.
Programs
-
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
Extensions
Edited & corrected by M. F. Hasler, Apr 10 2009
Comments