login
First differences of A006282.
1

%I #8 Jun 27 2021 07:53:25

%S 0,1,2,2,4,3,4,3,7,5,6,4,7,5,6,4,11,8,9,6,10,7,8,5,11,8,9,6,10,7,8,5,

%T 16,12,13,9,14,10,11,7,15,11,12,8,13,9,10,6,16,12,13,9,14,10,11,7,15,

%U 11,12,8,13,9,10,6,22,17,18,13,19,14,15,10,20,15,16,11,17

%N First differences of A006282.

%D D. E. Knuth, Art of Computer Programming, Sorting and Searching, Addison-Wesley, 1973, Section 5.2.2, ex. 14,15.

%H J.-P. Allouche and J. Shallit, <a href="http://www.cs.uwaterloo.ca/~shallit/Papers/as0.ps">The ring of k-regular sequences</a>, Theoretical Computer Sci., 98 (1992), 163-197, ex. 29.

%F a(0)=0, a(2n)=a(n)+floor(log_2(2n)), a(2n+1)=a(n)+1.

%o a(n)=if(n<1,0,if(n%2==0,a(n/2)+floor(log(n)/log(2)),a((n-1)/2)+1))

%K nonn,easy

%O 0,3

%A _Ralf Stephan_, May 05 2003