Write a simple formula that generates the below mentioned terms.
a) 1,2,2,3,4,4,5,6,6,7,8,8,...
b) 1,10,11,100,101,110,111,1000,1001,1010,1011
a.) 1,2,2,3,4,4,5,6,6,7,8,8,....
General formula
b.) 1,10,11,100,101,110,111,1000,1001,1010,1011
Then if n is a positive integer, n can be expressed uniquely in the form
Given a number n all you need to do it find the k where .
The binary representation of in k+1 bits is the answer.
Comments