For instance, if n=9, then exactly how many different values have the right to be represented in 9 binary digits (bits)?

My reasoning is that if I collection each of those 9 bits to 1, I will certainly make the highest possible number feasible that those 9 digits are able to reexisting. Therefore, the greatest value is 1 1111 1111 which amounts to 511 in decimal. I conclude that, therefore, 9 digits of binary deserve to recurrent 511 various worths.

You are watching: In general, how many things can be represented by n bits?

Is my thought procedure correct? If not, could someone kindly define what I"m missing? How can I generalize it to n bits?

binary bits
Share
Improve this question
Follow
edited Nov 1 "12 at 18:03 NullUserException
asked Sep 28 "10 at 1:26 SeanSean
4

58
29 = 512 worths, because that"s exactly how many type of combinations of zeroes and also ones you have the right to have actually.

What those values represent but will depfinish on the device you are using. If it"s an unsigned integer, you will have:

000000000 = 0 (min)000000001 = 1...111111110 = 510111111111 = 511 (max)In two"s enhance, which is typically supplied to recurrent integers in binary, you"ll have:

000000000 = 0000000001 = 1...011111110 = 254011111111 = 255 (max)100000000 = -256 (min) In general, through k bits you deserve to recurrent 2k values. Their range will certainly depend on the system you are using:

Unsigned: 0 to 2k-1 Signed: -2k-1 to 2k-1-1

Share
Follow
edited Sep 28 "10 at 2:58
answered Sep 28 "10 at 1:29 NullUserExceptionNullUserException
2
10
What you"re missing: Zero is a value

Share
Follow
answered Sep 28 "10 at 1:27 SamStephensSamStephens
2
A much better way to deal with it is to start small.

Let"s start via 1 little bit. Which have the right to either be 1 or 0. That"s 2 worths, or 10 in binary.

Now 2 bits, which deserve to either be 00, 01, 10 or 11 That"s 4 values, or 100 in binary... See the pattern?

Share
Follow
answered Sep 28 "10 at 1:33 Randy the DevRandy the Dev
1
Okay, since it currently "leaked": You"re missing zero, so the correct answer is 512 (511 is the greatest one, but it"s 0 to 511, not 1 to 511).

By the method, an good followup exercise would be to generalize this:

How many various values have the right to be represented in n binary digits (bits)?
Share
Follow
answered Sep 28 "10 at 1:29
1
1
Without wanting to offer you the answer right here is the logic.

You have 2 feasible worths in each digit. you have 9 of them.

choose in base 10 wbelow you have actually 10 various worths by digit say you have 2 of them (which makes from 0 to 99) : 0 to 99 provides 100 numbers. if you do the calcul you have an exponential function

base^numberOfDigits:10^2 = 100 ;2^9 = 512
Share
Follow
answered Sep 28 "10 at 1:30
community wiki
pastjean
1
There"s an simpler method to think about this. Start with 1 little. This have the right to obviously reexisting 2 worths (0 or 1). What happens as soon as we add a bit? We can currently recurrent twice as many kind of values: the worths we can represent before via a 0 appended and the worths we can recurrent prior to with a 1 appended.

So the the number of worths we have the right to reexisting via n bits is simply 2^n (2 to the power n)

Share
Follow
answered Sep 28 "10 at 1:32
davedave
1
The point you are missing is which encoding plan is being supplied. Tbelow are different ways to encode binary numbers. Look into signed number representations. For 9 bits, the varieties and also the amount of numbers that deserve to be stood for will differ depending on the device supplied.

Share
Follow
edited Sep 28 "10 at 1:57
answered Sep 28 "10 at 1:43
James KastrantasJames Kastrantas
5

Thanks for contributing an answer to Stack Overflow!

But avoid

Asking for aid, clarification, or responding to other answers.Making statements based on opinion; back them up through references or individual experience.

See more: Why Is Oil Coming Out Of My Dipstick, Oil Blowing Out Of Dipstick Tube

Draft saved

Submit

### Post as a guest

Name
Email Required, but never before shown

### Article as a guest

Name
Email

Required, but never before shown

## Not the answer you're looking for? Browse other inquiries tagged binary bits or ask your very own question.

The Overcirculation Blog
Upcoming Events
Featured on Meta
Visit chat
13
Why is the max integer in java 2^31 - 1 and not 2^31
0
Given N bits, how many kind of integers can be stood for in binary?
0
7-little bit two's complement
Related
934
How to count the number of set bits in a 32-little integer?
13
Java Working via bits
1
Number of Bits per image?
0
Binary digits in decimal
2
How Many Values Can Be Represented With n Digits in Hexadecimal Systems?
2
Three hexadecimal digits deserve to be used to represent 12 binary bits. Why is this sentence true?
0
How can I reexisting all the possible worths of n bits in base 2 making use of n bits in C?
0
Given N bits, how many integers have the right to be stood for in binary?
Hot Netoccupational Questions even more warm inquiries

Question feed

Stack Overflow
Products
Company 