%I #31 Aug 06 2023 08:19:30
%S 0,1,1,2,1,2,2,3,2,2,2,3,2,3,3,4,3,3,3,3,2,3,3,4,3,3,3,4,3,4,4,5,4,4,
%T 4,4,3,4,4,4,3,3,3,4,3,4,4,5,4,4,4,4,3,4,4,5,4,4,4,5,4,5,5,6,5,5,5,5,
%U 4,5,5,5,4,4,4,5,4,5,5,5,4,4,4,4,3,4,4,5,4,4
%N Number of i such that d(i) >= d(i-1), where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.
%H Antti Karttunen, <a href="/A033265/b033265.txt">Table of n, a(n) for n = 1..65537</a>
%H Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>
%H Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F From _Ralf Stephan_, Oct 05 2003: (Start)
%F a(0) = 0, a(2n) = a(n) + 1, a(2n+1) = a(n) + [n odd].
%F a(n) = A014081(n) + A023416(n).
%F G.f. 1/(1-x) * Sum_{k>=0} (t^2 + t^3 + t^4)/((1+t)*(1+t^2)), t=x^2^k). (End)
%F a(n) = -1 + A297113(A005940(1+n)). - _Antti Karttunen_, Dec 30 2017
%e The base-2 representation of n=4 is 100 with d(0)=0, d(1)=0, d(2)=1. There are two rise-or-equal, one from d(0) to d(1) and one from d(1) to d(2), so a(4)=2. - _R. J. Mathar_, Oct 16 2015
%p A033265 := proc(n)
%p a := 0 ;
%p dgs := convert(n,base,2);
%p for i from 2 to nops(dgs) do
%p if op(i,dgs)>=op(i-1,dgs) then
%p a := a+1 ;
%p end if;
%p end do:
%p a ;
%p end proc: # _R. J. Mathar_, Oct 16 2015
%o (PARI) A033265(n) = { my(i=0); while(n>1, if((n%4)!=1, i++); n >>= 1); (i); }; \\ _Antti Karttunen_, Aug 06 2023
%Y Cf. A014081, A023416, A037800, A037809, A005940, A156552, A297113, A364567 [= 2^a(n)].
%K nonn,base
%O 1,4
%A _Clark Kimberling_
%E Sign in Name corrected by _R. J. Mathar_, Oct 16 2015