login
See sequence A118268 for description.
2

%I #11 Oct 01 2017 00:02:22

%S 1,1,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,1,0,0,1,2,1,0,1,0,3,0,0,1,1,0,0,0,

%T 0,1,0,0,2,0,0,1,2,2,2,0,0,0,1,1,0,1,0,4,0,0,0,0,1,0,0,1,0,0,1,0,1,1,

%U 0,0,1,1,1,1,0,1,1,1,0,1,2,0,0,1,3,1,2,0,2,2,0,0,0,1,0,0,0,1,0,2,0,1,1,1,0

%N See sequence A118268 for description.

%H Michael De Vlieger, <a href="/A118269/b118269.txt">Table of n, a(n) for n = 0..10000</a>

%t MapAt[# + 1 &, #, 1] &@ FoldList[{#1~Join~IntegerDigits[#2, 2], #2} & @@ {First@ #1, SequenceCount[First@ #1, IntegerDigits[#2, 2]]} &, {{1}, 0}, Range@ 104][[All, -1]] (* _Michael De Vlieger_, Sep 30 2017 *)

%o Contribution from _Franklin T. Adams-Watters_, May 14 2010: (Start)

%o (PARI) inbase(n,b=10)=local(r);r=[n%b];while((n\=b)>0,r=concat([n%b],r));r

%o countsub(v,w)=local(r);r=max(#v-#w+1,0);for(k=1,#v-#w+1,for(j=1,#w,if(v[k+j-1]!=w[j],r--;break)));r

%o al(n)=local(v,r,ni);v=r=[1];for(k=1,n,ni=countsub(v,inbase(k,2));v=concat(v,inbase(ni,2));r=concat(r,[ni]));print(v);r

%o /* Prints A118268, returns A118269. */ (End)

%Y Cf. A118268.

%K easy,nonn

%O 0,22

%A _Leroy Quet_, Apr 20 2006

%E More terms from _Franklin T. Adams-Watters_, May 14 2010