login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A083742
First differences of A006282.
1
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, 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, 11, 12, 8, 13, 9, 10, 6, 22, 17, 18, 13, 19, 14, 15, 10, 20, 15, 16, 11, 17
OFFSET
0,3
REFERENCES
D. E. Knuth, Art of Computer Programming, Sorting and Searching, Addison-Wesley, 1973, Section 5.2.2, ex. 14,15.
LINKS
J.-P. Allouche and J. Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197, ex. 29.
FORMULA
a(0)=0, a(2n)=a(n)+floor(log_2(2n)), a(2n+1)=a(n)+1.
PROG
a(n)=if(n<1, 0, if(n%2==0, a(n/2)+floor(log(n)/log(2)), a((n-1)/2)+1))
CROSSREFS
Sequence in context: A366651 A274176 A356148 * A107331 A283187 A324391
KEYWORD
nonn,easy
AUTHOR
Ralf Stephan, May 05 2003
STATUS
approved