# Why is 2^16 a "special" number? [closed]

OK, I feel stupid asking this - but in Jeff's article: Getting the Interview Phone Screen Right and originally stated in the 5 essential phone screen questions:

They shouldn't stare blankly at you when you ask with 2^16 is. It's a special number. They should know it.

I've been a developer\software engineer\code monkey\whatever for a little while now, and I don't think I've ever come across this. I mean, I can certainly count binary values do basic operations on them, etc, etc. But I don't see what is "special" about this value.

• It's a power of 2? :) Feb 1, 2011 at 17:56
• @Michael `2^16.1` is also a power of 2, but nothing special. Same for `2^0`.
– user4595
Feb 1, 2011 at 19:21
• @Radek: `2**0` is `1`, which is in fact a very special number ;) But yes, we're generally only concerned with powers of two where the exponent is a positive integer.
– user7043
Feb 1, 2011 at 19:38
• Well, why is 10^3 or 10^6 a special number?
– user1249
Feb 1, 2011 at 22:14
• Is this an interview question from the 90s? 16 bits were special back then Feb 1, 2011 at 23:11

(216 - 1) or 65535 or `0xFFFF` or "64k" is the maximum value of 2 bytes. For a long time CPUs used 16-bit architecture and OSes were likewise based on 16-bit operations and "words". There were 16-bit commands and 16-bit memory addresses. A lot of systems/compilers still use 16 bits for integers.

So, (216 - 1) is special because it is the largest number that a 16-bit (unsigned) integer can hold and the largest memory address that a 16-bit architecture can access.

• FYI, it's also the number of rows in an Excel spreadsheet :) Feb 1, 2011 at 17:55
• Is that still the limit? Feb 1, 2011 at 18:02
• I stand corrected. Maybe it's been a while since I scrolled all the way down. Feb 1, 2011 at 18:12
• @Travis: Last sentence has an off-by-one error; 2^16 requires 17 bits.
– PSU
Feb 1, 2011 at 18:18
• 65535 is also the highest port number found in ipv4 (and ipv6?) protocols. Mar 14, 2013 at 5:37

From the full body from Steve Yegge's article,

Candidates should know what bits and bytes are. They should be able to count in binary; e.g. they should be able to tell you what 2^5 or 2^10 is, in decimal. They shouldn't stare blankly at you when you ask with 2^16 is. It's a special number. They should know it.

I was thrown off from the bit you quoted in the question; it sounded like a candidate should be able to describe it's significance, but in context he's saying that candidates should know, off the top of their head, what the decimal conversion of 216 is.

The significance of this is that since we humans still use decimal for counting, especially in our heads (in most circumstances), we need to know the rough capacities of the common byte blocks that we use for storage, memory, or even character encoding. Since a byte is 8 bits, the most common are 8, 16, 24, 32, and 64.

At the present time I would say 232 is the most commonly occurring capacity a developer deals with. I am suspicious of developers who don't know that 232 is roughly 4 billion (max value of ~2 billion if signed), since it means they've never bothered to find out roughly how many records can be stored in their databases that use 32-bit `int`s for primary keys, or when old code using 32-bit `int`s for IDs, dates, etc. will need to be refactored to 64-bit.1

216 is the total capacity of the Java `short`. (Total numbers between -215 and 215-1)

A developer should know by heart what 8-bit is. Among the many common usages is ASCII character encoding.

I wouldn't expect a programmer to know 214 or 218 at all, but I would probably expect that they know 216 since it's a very commonly occurring number and short enough number (65536) to easily remember the full number.

1: If you browse the leaderboards of Call of Duty: MW2 or iPhone Game Center you'll often see cheaters at the top with high score values of 2,147,483,647, which is 231-1, the max value of a signed 232 integer.

• A good thing to remember is that 2^10 is about one thousand, and from there you get 2^20 is a million, and 2^30 a billion and so on. And with help of this it's somewhat easy to "see" that 2^14 is sixteen million, so you can quickly do mental conversions between binary and decimal. And 2^64 is 16 * 10^18, which is hmm... 16 billion billions :) Feb 1, 2011 at 18:38
• @Maglob, thanks, good point. It's worth noting how you arrived at 2^64, since it took me a minute. 1000 is 10^3 which is roughly 2^10. 64 is 4 and 60. 60/10 is 6, 6 * 3 is 18, so you get: 10^18 * (2^4 or 16) ... Feb 1, 2011 at 18:45
• Uuh. I made a typo above (and somehow can't edit it) 2^14 is of course sixteen thousand, not million. (I guess it was not that easy to "see" after all :) Feb 2, 2011 at 11:39
• +1 Good answer, because a more complete context is that you are looking for the person being able to think, and in particular to have knowledge of the context and domain. Apr 23, 2013 at 6:49
• Um, ASCII is 7-bit.. ;-) Jul 20, 2013 at 9:46

The only reason I can see for regarding 216 as "special" is because it's one more than the highest integer you can store in a single register on a 16 bit operating system.

Similarly you could apply the same logic to 232 and 32 bit operating systems.

I'd need to know more context for the question before being able to say whether it was a significant piece of knowledge or not.

• I swear I must have filtered out most of what you wrote. All I saw was 2^16 and highest integer. Feb 1, 2011 at 17:55
• This is inaccurate. It is perfectly possible to have a 32-bit (or higher) data type in a 16-bit operating system. A 16-bit integer is simply the largest value that can be stored in a single register on a 16-bit processor. Feb 1, 2011 at 23:37
• @Chinmay - point taken ;)
– ChrisF
Feb 1, 2011 at 23:38