Question #177364

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


1
Expert's answer
2021-04-12T17:23:40-0400

a.) 1,2,2,3,4,4,5,6,6,7,8,8,....

General formula a(n)=a(n1)+a(n3)a(n4)   For n>4a(n)=a(n-1)+a(n-3)-a(n-4)\ \ \ \text{For n>4}


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 21+22+23...+2k<n<21+22+23...2(k+1)2^1+2^2+2^3 ...+2^k < n < 2^1+2^2+2^3 ...2^{(k+1)} .

The binary representation of n(21+22+23...2k)n-(2^1+2^2+2^3 ...2^k) in k+1 bits is the answer.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS