Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Why is -1 needed to get 65,535 from a 2^16 binary power calculation?

+0
−7

It was stated in the Wikipedia article 65,535:

65535 occurs frequently in the field of computing because it is 2^16-1 (one less than 2 to the 16th power), which is the highest number that can be represented by an unsigned 16-bit binary number.

I didn't understand from this passage why is the -1 needed to get the number 65,535 from the power operation.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

The short answer: because 216 = 65536, it follows that 216 - 1 = 65535.

Remember how exponentials work: in is i multiplied by itself n times (for integer values of n ≥ 1).

Therefore, 216 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2. (2 multiplied by itself 16 times.) Since the only distinct multiplicant is an even number, it follows that the result must also be an even number.

216 is the number of distinct values that can be represented with exactly 16 symbols each taking one of two values (in this case, traditionally 0 and 1). The more general form is mn where m is the size of the symbol set, and n is the number of symbols being used. The latter is why, for example, 216 = 164 (you can use 16 binary digits, or 4 hexadecimal digits, to represent the same value range).

When you include being able to represent the number 0, which is often useful and the lack of which would require some kind of special handling, the maximum number possible to represent within 216 distinct values is 216 - 1; you need to subtract 1 because the value 0 is one ("1") possible value.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »