# Is there an easier way to calculate large powers of 2?

Mar 6th, 2008

Does anyone know of an easier way to calculate large powers of 2 than the way I've come up with? The reason I'm asking is I haven't found my way very easy, but is easier to me than memorizing the powers of 2.

Here's what I do. First you do need to at least memorize the numbers for 2^8 (256), 2^16 (65,536) and 2^24 (16,777,216). Then if I wanted to calculate a number like 2^20, I'd subtract the next lower power of 2 I memorized, 2^16 from 2^20 = 2^4. I'd then multiply 2^16 * 2^4 to get my answer or 65,536 * 16 = 1,048,576.

This way still requires multiplying large numbers or factoring which isn't very quick either (well, at least for me).

I'm looking for a quicker way to come up with an answer on subnetting questions that ask how many hosts you'd have if, as in this example, you'd have 20 host bits.

Hope this makes sense and any help would be appreciated.

Regards,

Dale

Overall Rating: 0 (0 ratings)

## Replies

Hi Dale

I suppose that I just memorised the numbers from 2 up to 65536, doubling each of the previous numbers.

i.e 2, 4, 8, 16, 32, 64, 128, ....... 65536

After that it's pen and paper time. Though I have very rarely if ever had to go that high yet outside of study.

Best Regards,

Michael

dale_lorenzen Sun, 03/09/2008 - 22:46

Hi Michael,

Thanks for the reply. That's pretty much what I've done. I just got stumped on a prep question that had 20 host bits. I was trying to figure out that quickest way to calc a number like that one. I'd thought of memorizing the powers of 2 to 2^24, but that got ugly pretty quick. Even up to 65536 My head still hurts from trying :-)

Hi Dale

I memorised that 2^10 = 1024 and 2 ^ 15 is 32768.

Working out 2 ^ (1-10) is pretty easy in your head.For a question where I had to work out 2^20, I would just start at 32768 and with a pen and paper just double this number, then double the result five times until I got the answer I required.

If the figure had of been between 10 and 15 I would have started at 1024.

I found it easy to remember this two figures and this method served and continues to serve me well.

Best Regards,

Michael

CSCO10892433 Mon, 03/10/2008 - 07:19

Hi, dale

Try the following way:

2^20

=2^10*2^10

=1024*1024

=(1000+24)*(1000+24)

=1000*1000+1000*24+1000*24+24*24

=1000000+48000+576

=1048576

Dose it make things better?

HTH

SSLIN

swmorris Mon, 03/10/2008 - 08:13

It might be easier just to rough-it the other way...

You mentioned that you had a hard time with 20 bits of hosts...

Well, if you know that 2^24 is roughly 16.7 million... If you have 20 host bits, you have 4 network bits. Why not just divide 16.7 million by 16? If you need to be more precise than 1 million'ish hosts then you may need to look at something else, but I don't think the goal is memorization of binary stuff.

Just my two cents.

HTH,

Scott

[email protected]

toddlerdal Mon, 03/10/2008 - 08:22

I guess you could say I cheat on this one. I've got a chart that I used for the exams to help. Something like this:

...|...|...|...|...|...|...|255|

...|...|...|...|...|...|254|...|

...|...|...|...|...|252|...|...|

...|...|...|...|248|...|...|...|

...|...|...|240|...|...|...|...|

...|...|224|...|...|...|...|...|

...|192|...|...|...|...|...|...|

128| 64| 32| 16| 8| 4| 2| 1|

2^7|2^6|2^5|2^4|2^3|2^2|2^1|2^0|

/25|/26|/27|/28|/29|/30|/31|/32|

Sorry the format didn't work out too well, hopefully you get the idea.

This would be for the 4th octet of the ip address. Basically, from here you can just count it up working to the left.

Hope this helps

dale_lorenzen Mon, 03/10/2008 - 21:24

Your way is a lot like what I've been doing except in reverse. You're counting back from 2^24 and I'm counting up from 2^16.

I'm just trying to get prepared for questions that may have big binary numbers on subnetting questions. I may be spinning my wheels, but since I don't know what's on the test and can only go by the practice questions I've been doing (cisco press and others), I keep trying to come up with a better way of doing it. So far for me the way I've been doing it works.

Thanks for the help to eveyone that responded.

Cheers,

Dale