%I #13 Oct 13 2013 22:35:34
%S 0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,
%T 0,0,1,1,1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,
%U 1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0
%N Sequence with each term appearing in runs of every length infinitely often.
%C This construction is in stages for sequence range 0, 1:
%C Stage 1: 0, 1
%C Stage 2: 0, 1, 0, 0, 1, 1
%C Stage 3: 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, etc.,
%C where each stage is the previous stage (if any) followed by stage-number of zeros then stage-number of ones. The sequence is all stages read sequentially as rows. See PARI program for comments about stage lengths and cumulative lengths.
%C For each positive integer n each term appears in runs of length exactly n infinitely often. This sequence's construction process, which can clearly be generalized for any (finite) number of distinct terms, has A079813 as the limit of its n-th stage as n --> infinity.
%H Rick L. Shepherd, <a href="/A209355/b209355.txt">Table of n, a(n) for n = 1..10000</a>
%e Terms a(15) through a(17) are the first run (of infinitely many such runs) of exactly three zeros.
%o (PARI)
%o /* range = vector of r >= 2 integers in desired order. */
%o /*(r = 0,1 allowed but [],constant seq., resp., result)*/
%o /* stages_wanted >= 1 (or empty vector returned). */
%o /* Stage (Row) sizes for r = 2 integers in range are */
%o /* 2,6,12,20,30,42,... (A002378(stage) for each stage),*/
%o /* producing vector v's A007290(stages_wanted+2) terms.*/
%o /* */
%o {a(range, stages_wanted) =
%o local(v = [], next_stage = [], stage = 0, k, m);
%o while(stage<stages_wanted,
%o stage++;
%o for(k=1, matsize(range)[2],
%o next_stage=concat(next_stage,vector(stage,m,range[k]))
%o ); v = concat(v, next_stage);
%o ); return(v)}
%o /* A209355 = a([0,1], 6); /* 112= 2+6+12+20+30+42 terms*/
%o A209355 = a([0,1], 31); /* 10912 = A007290(33)terms */
%o for(n=1, 10000, write("b209355.txt", n, " ", A209355[n]))
%Y Cf. A079813, A002378, A007290.
%K nonn,easy
%O 1
%A _Rick L. Shepherd_, Mar 06 2012
|