Mental Block - quick math Q
Author
Discussion

TheExcession

Original Poster:

11,669 posts

274 months

Thursday 14th October 2004
quotequote all
IP Subnets and Hosts and Subnet bits.

My minds gone blank.

Given that
2^(number_of_bits) – 2 = number_of_hosts

I want to get a value for number_of_bits given that I know the number of hosts.

what is the inverse of 2^n

feeling very dumb - thanks for an answer.

best
Ex

Hamster

136 posts

261 months

Thursday 14th October 2004
quotequote all
Blimey

How can you feel dumb for not knowing the answer to this. I don't even understand the question............

KS

TheExcession

Original Poster:

11,669 posts

274 months

Thursday 14th October 2004
quotequote all
ok - given

2^y=n
y=??? when n=256

eg

y=2 -> 2^2 = 4
y=3 -> 2^3 = 8
y=4 -> 2^4 = 16
y=5 -> 2^5 = 32

if for example I tell you the answer is 64 then the question was y=6 easy to spot but what is the question when the answer is 256? Obviously its 8 but why? and what is the question when the answer is 1073741824?

best
Ex

>> Edited by TheExcession on Thursday 14th October 14:28

AlexHancock

466 posts

292 months

Thursday 14th October 2004
quotequote all
The inverse is ^ 1/n.

So if n is 2

The inverse of 2 ^ 2 is 2 ^ 0.5

Edited for Ex

2 ^ 256 is 1.1579208923731619542357098500869e+77

So to get back

1.1579208923731619542357098500869e+77 ^ 0.00390625

where 0.00390625 is 1/256

>> Edited by AlexHancock on Thursday 14th October 14:36

TheExcession

Original Poster:

11,669 posts

274 months

Thursday 14th October 2004
quotequote all
knew it was in my head somewhere

number bits = [log (hosts + 2) ]/ log 2

AlexHancock

466 posts

292 months

Thursday 14th October 2004
quotequote all
Good stuff - I suddenly realised I was giving you the wrong answer! It was more interesting than my current development though...

TheExcession

Original Poster:

11,669 posts

274 months

Thursday 14th October 2004
quotequote all
AlexHancock said:
Good stuff - I suddenly realised I was giving you the wrong answer! It was more interesting than my current development though...


cheers -

Good old Napier - I'd forgotten all about him and his bones.

best
Ex

Pigeon

18,535 posts

270 months

Thursday 14th October 2004
quotequote all
Shift it right until it's zero, and count the number of shifts.