mozy contest: problem 1 PHP solution
Shane Hathaway
shane at hathawaymix.org
Mon Nov 6 14:39:52 MST 2006
Dave Smith wrote:
> Bryan Sant wrote:
>> On 11/6/06, Levi Pearson <levi at cold.org> wrote:
>>> When programming in C, C++, or Java (among others), standard numeric
>>
>> No, in java you use the BigInteger or BigDecimal class to deal with
>> big numbers. These are arbitrary-precision numbers. They will grow
>> until you run out of memory (or address space -- 32-bit systems blow).
>
> And in C/C++, you use GMP, which is really cool. I love having a single
> integer that could use up your entire 4GB of virtual memory.
>
> Trivia: What's the largest integer that can be expressed with 4GB of
> storage? What about 4GB * 4GB (i.e., 64 bits)?
Well, just as 4cm * 4cm = 16 cm^2, 4GB * 4GB = 16 GB^2. That's assuming
we can figure out what a square byte is. I assume you meant to ask what
the largest integer is that can be expressed with 16 exbibits[1] of memory.
You didn't specify a representation. I suppose each combination of bits
should express a different integer, and the expressible integers should
range from 0 to some big number with no gaps in the sequence. That
rules out all kinds of tricks like Busy Beaver numbers. Oh well.
Given those rules, n bits can express integers from 0 to (2^n - 1). n
is 2^64, so 16 exbibits can express integers from 0 to (2^(2^64) - 1).
[1] http://en.wikipedia.org/wiki/Exbibit
Shane
More information about the PLUG
mailing list