This is a homework question that I am stuck with.
Consider unsigned integer representation. How many bits will be required to store a decimal number
The short answer is:
int nBits = ceil(log2(N));
That's simply because pow(2, nBits) is slightly bigger than N.