Question

Just asked by my 5 year old kid: what is the biggest number in the computer?

We are not talking about max number for a specific data types, but the biggest number that a computer can represent.

Infinity is not allowed.

UPDATE my kid always wants to print as well, so lets say the computer needs to print this number and the kid to know that its a big number. Of course, in practice we won't print because theres not enough trees.

Was it helpful?

Solution

This question is actually a very interesting one which mathematicians have devoted a fair bit of thought to. You can read about it in this article, which is a fascinating and accessible read.

Briefly, a guy named Tibor Rado set out to find some really big, but still well-defined, numbers by defining a sequence called the Busy Beaver numbers. He defined BB(n) to be the largest number of steps any Turing Machine could take before halting, given an input of n symbols. Note that this sequence is by its very nature not computable, so the numbers themselves, while well-defined, are very difficult to pin down. Here are the first few:

BB(1) = 1
BB(2) = 6
BB(3) = 21
BB(4) = 107

... wait for it ...

BB(5) >= 8,690,333,381,690,951

No one is sure how big exactly BB(5) is, but it is finite. And no one has any idea how big BB(6) and above are. But at least these numbers are completely well-defined mathematically, unlike "the largest number any human has ever thought of, plus one." ;)

So how about this:

The biggest number a computer can represent is the most instructions a program small enough to fit in its available memory can perform before halting.

Squared.

No, wait, cubed. No, raised to the power of itself!

Dammit!

OTHER TIPS

Bits are not numbers. You, as a programmer, give them the meaning you want, possibly numbers.

Now, I decide that 1 represents "the biggest number ever thought by a human plus one".

Errr this is a five year old?

How about something along the lines of: "I'd love to tell you but the number is so big and would take so long to say, I'd die before I finished telling you".

//  wait to see
for(;;)
{
    printf("9"); 
}

roughly 2^AVAILABLE_MEMORY_IN_BITS

EDIT: The above is for actually storing a number and treats all media (RAM, HD, cloud etc.) as memory. Subtracting the OS footprint (measured in KB) doesn't make "roughly" less accurate...

If you want to "represent" a number in a meaningful way, then you probably want to go with what the CPU provides: unsigned 32 bit integers (roughly 4 Gigs) or unsigned 64 bit integers for most computers your kid will come into contact with.

NOTE for talking to 5-year-olds: Often, they just want a factoid. Give him a really big and very accurate number (lots of digits), like 4'294'967'295. Then, once the glazing leaves his eyes, try to see how far you can get with explaining how computers represent numbers.

EDIT #2: I once read this article: Who Can Name the Bigger Number that should provide a whole lot of interesting information for your kid. Obviously he's not your normal five-year-old. So this might get you started in a cool direction about numbers and computation.

The answer to life (and this kids question): 42

That depends on the datatype you use to represent it. The computer only stores bits (0/1). We, as developers, give the bits meaning. (65 can be a number or the letter A).

For example, I can define my datatype as 1^N where N is unsigned and represented by an array of bits of arbitrary size. The next person can come up with 10^N which would be ten times larger than my biggest number.

Sure, there would be gaps but if you don't need them, that doesn't matter.

Therefore, the question is meaningless since it doesn't have context.

The size will obviously be limited by the total size of hard drives you manage to put into your PC. After all, you can store a number in a text file occupying all disk space.

You can have 4x2Tb drives even in a simple box so around 8Tb available. if you store as binary, then the biggest number is 2 pow 64000000000000.

If your hard drive is 1 TB (8'000'000'000'000 bits), and you would print the number that fits on it on paper as hex digits (nobody would do that, but let's assume), that's 2,000,000,000,000 hex digits.

Each page would contain 4000 hex digits (40 x 100 digits). That's 500,000,000 pages.

Now stack the pages on top of each other (let's say each page is 0.004 inches / 0.1 mm thick), then the stack would be as 5 km (about 3 miles) tall.

I'll try to give a practical answer.

Common Lisp number crunching is particularly powerful. It has something called "bignums" which are integers that can be arbitrarily large, limited by the amount of available.

See: http://en.wikibooks.org/wiki/Common_Lisp/Advanced_topics/Numbers#Fixnums_and_Bignums

Don't know much about theory, but I far as I understood from your question, is: what is the largest number that the computer can represent (and I add: in a reasonable time, and not printing "9" until the Earth will "be eaten by the Sun"). And I put my PC to make one simple calculation (in PHP or whatever language): echo pow(2,1023) - resulting: 8.9884656743116E+307. So I guess this is the largest number that my PC can calculate. On the other side, I think the respresentation of the largest negative number can be: -0,(0)1

LE: That computed value was obataind through PHP, but I tried to figure out what's the largest number that my windows calculator can compute, and it is pow(2, 33219) = 8.2304951207588748764521361245002E+9999. Now I guess this is the largest number my PC can handle.

Depends on how much the computer can handle. Although there are some times when the computer can handle numbers greater than (2^(bits-1)-1)... For example: My computer is 64 bit (9223372036854775807), however the calculator that comes with the computer itself can handle numbers of up to 10^9999.

Many other supercomputers can exceed these limits, and the one with the most memory (bits) might as well be the one with the record (current largest number that can be held by computers).

Or, if it comes to visually seeing it on computers, you can just make a program that, on monitor, repeats writing 9 and not skips that line to form an ever-growing bunch of 9. :P

Well I had the same question earlier this day, so thought why not to make a little c++ codes to see where the computer gonna stop ... But my laptop wasn't with me in class so I used another, well the number was to big but it never ends, i'll run it again for a night then i'll share the number you can try the code is stupid

#include <stdlib.h>
#include <stdio.h>

int main() {
    int i = 0;

    for (i = 0; i <= i; i++) {
        printf("%i\n", i);
        i++;
    }
}

And let it run till it stops ^^

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top