Knowing a handful of powers of 2 can be really useful for all sorts of machine storage related estimations. I’m going to share what I consider to be the most common powers of 2, where they show up in computing, and some tips on remembering them.
|20||1,048,576 (1 Million)|
|30||1,073,741,824 (1 Billion)|
|31||2,147,483,648 (2 Billion)|
|32||4,294,967,296 (4 Billion)|
|40||1,099,511,627,776 (1 Trillion)|
2 ^ 3 to 2 ^ 6
These are small enough that you can mentally compute them quickly, but they’re good to know (particularly 2 ^ 6) for the sake of remembering the larger powers.
Some memory tips:
2 ^ 4 = 16. This is the same as 4 ^ 2. Or, if you remember that 2^3 = 8, you can just double that (this is really handy thanks to base 2).
2 ^ 7
7 bits are used to represent the entire (non-extended) ASCII character set which is 128 characters. The characters go from 0 to 127 inclusive. 0 represents the NULL characters and 127 is the delete character.
2 ^ 8
Nowadays, we consider 8 bits to be a single byte. In C, you’ll often see data type storage sizes in terms of bytes. A signed character requires a single byte.
A byte is also considered the smallest addresssable unit of memory in many computers because early computers used 8 bits to represent a single character of text.
I don’t have great tips for remembering this other than just doubling 128 assuming you’ve committed 2 ^ 7 to memory. Sorry. Luckily, it turns up so often that you probably won’t forget it.
2 ^ 10
The Kilobyte! Or 1024 bytes.
Kilobytes turn up everywhere. Lots of small files (like this post) are around a single kilobyte. In the 90’s (when I was still in elementary school), there were floppy discs that had capacities of only hundreds of kilobytes!
This tells us that if a program only needed to store 1000 ASCII characters, we only need a kilobyte of memory since that will allow us to address 1000 8 bit characters.
How to remember: 2 ^ 10 -> reverse the 10 and the 2 so it’s 102…4.
This is also hugely important for remembering some of our later powers. The 10 represents ~1000 which happens to be 3 orders of magnitude. The reason that’s important is that if we go from 2 ^ 10 to 2 ^ 20, that’s the same as 2 ^ 10 times 2 ^ 10 which is the same as increasing the value by three orders of magnitude. I’ll revisit this again later.
2 ^ 16
16 bit CPU’s were quite common in the 70’s - 80’s. The PDP-11 was a pretty popular minicomputer with a 16 bit CPU and one of the first computers that the creators of the Unix operating system (Dennis Ritchie nad Ken Thomposen) ported the OS to.
The popular online course called NAND2Tetris (which I’ve taken) on building a computer from the ground up from virtual logic gates also uses a 16 bit architecture.
How to remember:
Note the ending 6 in the power 16. You can use that to remember that the value begins with a 6 (65k).
2 ^ 20
The megabyte! This is 1000 kilobytes. We’ve gone three orders of magnitude up from the kiloyte. An iphone photo is about 2-3 megabytes.
The easiest way to remember 2 ^ 20 is to remember 2 ^ 10 and the order of magnitude rule. 2 ^ 10 is about 1000. So if we’re going from the power 10 to a power 20, it’s the same as multiplying by 1000.
2 ^ 30, 2 ^ 31, 2 ^ 32
These three are important because many modern (at the time of writing) computers still use 32 bit architectures.
2 ^ 30 is key because it represents a gigabyte! A gigabyte of storage can maybe store a 1.5 hour movie. If you use virtual machines from cloud computing providers like AWS, the memory for their VM’s are typically between 2-8 gigabytes at time of writing.
2 ^ 31 appears often as representing the maximum signed integer in a 32 bit architecture. One of the bits is used as the signed bit for twos complement.
2 ^ 40
Finally, we get to the terabyte. How many gigabytes are in a terabyte? Using our 3 order of magnitude rule (2 ^ 10), going from 2 ^ 30 to 2 ^ 40 is multiplying a gigabyte by a thousand.
Compared to the 70’s and 80’s, this seems like a ridiculous amount of storage but you could easily purchase 1+ terabyte external hard drives nowadays.