Jump to content
BrainDen.com - Brain Teasers
  • 0


phaze
 Share

Question

While in university (Computer Science) the lecturer put up a slide with the value of 2^32 on it

One of the more outspoken members of the class quickly fiddled with there calculator and stated

that the value was wrong. They claimed that it was out by one.

I took a quick look at the board and stated that the one on the board was correct

How did I know?

Could I have been wrong?

If so what should have I said?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I'm guessing that you noticed that the value written on the board was even. If so, there's no way the answer could be out by one. It could have been out by 2, 4, 6, etc. but could not have been out by 1.

Since you were in computer science class, the value of 2^32 was probably written in binary instead of decimal. So with your quick glance you counted the number of 0s written on the board. Confirming that there were, in fact, 32 0s, you knew that the correct representation 2^32 was on the board.

Link to comment
Share on other sites

  • 0

First, did you mean off by 1 factor of 2, or off by the value 1?

If it was off by the value 1, it would be an odd number, so obviously couldn't have been 2^32.

He probably was thinking of the largest number representable by an unsigned 4-byte integer (off by 1 due to 0 based).

If it was off by a factor of 2, 2^30 starts with 1 (1024^3), so multiplying by 4 (=2^2) results in 2^32 starting with 4. And it would be in the billions = 10 digit number.

You could also make sure the last digit was the right one using modular arithmetic.

2^1 = 2

2^2 = 4

2^3 = 8

2^4 = 16

2^5 = 32

2^6 = 64

etc.

Notice that the last digit cycles through 2,4,8,6,2,4,8,6,etc. So if you mod by 4 you'll see it should end in 6.

Yes, you could have been wrong, but the number probably looked right.

Link to comment
Share on other sites

  • 0

While in university (Computer Science) the lecturer put up a slide with the value of 2^32 on it

One of the more outspoken members of the class quickly fiddled with there calculator and stated

that the value was wrong. They claimed that it was out by one.

I took a quick look at the board and stated that the one on the board was correct

How did I know?

Could I have been wrong?

If so what should have I said?

The number will obviously be even, so if I take you literally,the one's digit would be even according to one of you (presumably yourself) and odd per the other.

Every computer science student knows that 2^10 = 1024, 2^20 = 1024^2, 2^30 = 1024^3; so 2^32 must end in 4^3 x 4 = 4^4 mod 10, or 2^8 mod 10, or 256 mod 10, which is 6.

Link to comment
Share on other sites

  • 0

What really happened was

How did I know?

The one on the board was divisible by 2

Could I have been wrong?

Yes, both answers could have been wrong

If so what should have I said?

Depends, Probably best to be diplomatic and say the one on the board was correct rather than being technically accurate by saying the one on the calculator is wrong

Never trust a cheap calculator over common sense

Edited by phaze
Link to comment
Share on other sites

  • 0

The number will obviously be even .

Every computer science student knows that 2^10 = 1024, 2^20 = 1024^2, 2^30 = 1024^3; so 2^32 must end in 4^3 x 4 = 4^4 mod 10, or 2^8 mod 10, or 256 mod 10, which is 6.

Link to comment
Share on other sites

  • 0

The only response the classmember could have provided that would be "off" the posted answer "by one" would reveal an odd number (if the posted answer was truly correct).

As multiples of two, all powers of two greater than 2<0 would be even.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...