Any math geniuses here?

Kirby

Active Member
Reaction score
227
I found Prime95 many years ago and have since checked up on the prime number search from time to time, which I just did recently. The largest prime found so far is over 22 million digits long. The next 2 prizes are for a 100 million digit prime and a billion digit prime. I have been trying to wrap my head around those number and just can't get there. I need someone to tell me how big those numbers are in terms I can understand, like Gigabytes. I started the download for the file "A billion digits of PI" and saw that a representation of a billion digits, using 8 bits per digit, was, if I recall, 954MB. I did not complete the download, just started it, checked the size, copied the .PART file and hex edited it to see the format, by the way. It was single digits, one period, standard ASCII and no file header or apparent overhead, in the beginning anyway.

So, here are my questions. Are there really about a billion digits worth of bits times 8 on my terabyte hard drive? And how would you represent a number with a billion digits in a term I could comprehend? I'm not even sure how multiplication or division would effect that exactly. I suppose I'm going to have to break it into "chunks" (like 1,000 x 1,000 x 1,000 etc.) to get the base number to something I can comprehend, but even a thousand digit number is pretty incomprehensible and I'm having trouble switching between "number" and "number of digits". Can anyone Big Numbers for Dummies it for me? Would it literally be a 10 digit number x a 10 digit number 9 times or, essentially "A billion, billion, billion, billion, billion, billion, billion, billion, billion"? Because I can comprehend those chunks.

And let's say I wanted to address a specific number in there once I broke it down into these "chunks". I could get in the ballpark with 9 groups of 10 digits, but that would be with multiplication. It would be x1*x2*x3*x4*x5*x6*x7*x8*x9. Then I would have to have a 10th number to either add to or subtract from that number to get to the actual number. How big would that number need to be? Because it seems incomprehensible that I could use, say, 100 digits to represent any number from 1 to 1 billion digits. So it's unlikely the final number would be only 10 digits. I would have to use some other "tricks" to zero in on the actual number.

Just so you know, I have no real math education, but I love the hell out of math. Math explains how the universe works. I find math to be mysterious and beautiful and I have a need to understand it. It is pretty much the last remaining "great love of discovery" I have.
 
Last edited:
I think that the average [system of] education and experience just plain doesn't lead to being able to comprehend large numbers like this in the way that you imagine. I'm sure someone will roll out an analogy like "imagine each unit is a grain of sand - now imagine a stack of train cars filled with sand high enough to go to Pluto and back 18 times" or something, but that only replaces one ungrokable concept with another.

I'm kind of a math guy myself (I was in the actuarial field for 20+ years and I'm pretty well read on non-linear mathematics) and I'm not sure how reducing the thing to a series of "chunks" as you say, multiplied together makes it any more understandable than the any one of a myriad of grains-of-sand analogies. So, in the end, I think you should probably let go of looking for a representative way of comprehending very large numbers. Call it a centillion-on-steroids or call if whatever you like, it's just a BFN. :-)
 
Just so you know, I have no real math education, but I love the hell out of math. Math explains how the universe works. I find math to be mysterious and beautiful and I have a need to understand it. It is pretty much the last remaining "great love of discovery" I have.
I'm a bit a of a math(s) nut too ... Love doing maths. I'm mostly self-taught, though I did achieve a Diploma-level Distinction in applied mathematics (largely electronics related) many moons ago ...

I started the download for the file "A billion digits of PI" and saw that a representation of a billion digits, using 8 bits per digit, was, if I recall, 954MB. I did not complete the download, just started it, checked the size, copied the .PART file and hex edited it to see the format, by the way. It was single digits, one period, standard ASCII and no file header or apparent overhead, in the beginning anyway.

So, here are my questions. Are there really about a billion digits worth of bits times 8 on my terabyte hard drive? And how would you represent a number with a billion digits in a term I could comprehend?
You seem to be mixing up digits with bits. Taking a billion to mean one thousand million (some people define it as one million million, I believe) then a Terabyte is a trillion bytes and a Gigabyte is a billion bytes. So your Terabyte drive would contain approximately 8 x 1 million x 1 million (8, 000, 000, 000, 000) bits. That's not the same as digits, however they could be used to store or represent digits of course. Strung end-to-end, a Terabyte could be used to represent a binary number 8 trillion digits long. Or, arranged as bytes representing ASCII decimal digits (which is of course a very inefficient way of representing the digits 0-9) it could be used to represent or store a decimal number one trillion bits long. Your download was presumably stored in the same inefficient ASCII format since it was close to 1 Gigabyte (one billion bytes) in size.

Just to complicate matters, with computer storage, it also depends on whether we're talking about Megabytes and Gigabytes or Mebibytes and Gibibytes.
 
I am no genius but those that are seem to use exponents to represent large numbers https://en.wikipedia.org/wiki/Large_numbers and https://www.mathsisfun.com/exponent.html

Wikipedia: As of January 2016, the largest known prime number is 2 x 74,207,281 − 1, a number with 22,338,618 decimal digits. So that's roughly 22Mb of ASCII characters to store it in a text file. To store the numbers 0 to 9 in binary you only need 4 bits so you could store it in half the size if you used 4 bits - 11Mb. But with 4 bits you can store 16 different numbers, not just 10, so converting the 22 million decimal digit number into HEX and storing that instead means you can store it more efficiently in bits - about 8.3Mb.

Or using exponents 'simply' write 11 characters: 274207281−1 (small numbers should be superscript).

1Tb hard drive: 1024Gb * 1024 Mb * 1024Kb * 1024bytes = 1,099,511,627,776 bytes - one Trillion bytes (or a trillion 8 bit ascii characters). That's 1000 billion bytes

I think it's pointless trying to get your head around the sizes unless you use them every day. The scientists will just give it another name when it becomes mainstream and bingo, you'll have a 1Dsf hard drive instead of a 1Tb hard drive.
 
Reminds me of my old computer science days when I had to write code in assembler to show prime numbers, using the Sieve of Eratosthenes, on my final exam. Although I got an A+ in the course, I'd be hard pressed to replicate the code now, more than 20 years later.
 
I am confusing bits and digits, but that's not what I was getting at there. In this case a billion digits of PI take up 954GB of space, apparently. So, using 8 bits per digit there is (just) enough space on my hard drive to represent a billion digit long number. So I guess I answered my own question there as "a billion 8 bit storage slots" isn't really that outrageous, now that I think about it. My hard drive has right about enough space to represent a single 1 billion digit number. What I am really confusing here is "a billion" and "a billion digits", I think, as the number is just so astronomical as to boggle the mind.

Yes, I am aware how they represent the prime numbers, this particular prime being a "Mersenne Prime" or one which can be represented in the form of 2^x-1. My confusion is really more how you would even perform math on numbers this size. What if I wanted to represent a number 10,001 higher than 274207281−1? How would I even add 10,001 to that number? What if I wanted to divide it by 2? That's easy if it's a factor of 2. I just make it 274207280 (ignoring the "-1"). But what if it's 374207281-1? How would I divide that by 2?

What I am really wanting here (and it's probably not the format for me to learn it, i.e., a college mathematics course) is an understanding of how mathematics works on this scale, how I would represent any given number of a large scale, not just Mersenne numbers, and how I would perform a mathematical operation on them.

Also, one things I'm still not clear about is how big a billion digit number really is. If I were to use a single bit to represent each number from the number 1 to the highest number having one billion digits how big would the data be (assuming 1,000 byte/kilobyte/megabyte/gigabyte/terabyte/petabyte conversion, not the 1,024, just to keep things simple)?

I know it's a stupid place to ask the question, and I won't care about it in a week, I'm sure, but right now it's the single thing on my mind and it's driving me nuts that I don't know.
 
I am confusing bits and digits, but that's not what I was getting at there. In this case a billion digits of PI take up 954GB of space, apparently
You said 954MB earlier. Assuming we're defining one billion as one thousand million, 954GB would be close to 1MB per digit! Unless each digit is being stored as a jpg image, 954GB seems a bit excessive!
 
You said 954MB earlier. Assuming we're defining one billion as one thousand million, 954GB would be close to 1MB per digit! Unless each digit is being stored as a jpg image, 954GB seems a bit excessive!
Yup! 1 billion bytes / 1024 =
976,562.5 kb / 1024 =
953Mb
 
Also - you could store a program that would calculate Pi to 1 billion digits in a very small space, probably less than 500k. Just sayin' :)

Edit: Found one! 153kb zipped.

Further edit - just for fun, I now have a text file with a million digits of Pi, which is 1.25MB in size. There is extra space because the program separates each line by groups of 10 digits with separating spaces, and there is a running total of the digits at the end of each line, but close enough. 1.25MB * 1000 = 1.25GB for a Billion digits.
 
Last edited:
You said 954MB earlier. Assuming we're defining one billion as one thousand million, 954GB would be close to 1MB per digit! Unless each digit is being stored as a jpg image, 954GB seems a bit excessive!
Man, I hate when I do that. I'm a frigging computer guy. I'm not supposed to mix up MB and GB!
 
Just a few points that might make it easier to do such math.
  • Binary data (1's and 0's) are called bits (a single 0 or 1) and are stored in groups of 8 called a byte.
  • In a hex editor a byte is displayed as two Hex characters ranging from 0 to F. For example 0000 = 0, 0001 = 1, 1111 = F and there's two of them. So a single byte might look like 25, 11 , 2B, C0, 55, AA, etc. The lowest value is 00 and the highest is FF of a single byte.
  • A byte is then tranlated into a single ACII character of which there are 256 possibilities.
  • Bytes are stored in what's called a sector (typically 512 bytes each, but 4096 on newer drives)
Since you'd only need to be storing numbers, not actually letters, it is possible that each number could be recorded using just 4 bits and thus store two digits per byte. However most software wouldn't know how to work with data in this format, so let's just assume that you'd be recording it using a full byte (single ACII character) to store each number.

A typical 1TB WD HDD has 1,953,525,168 sectors. Multiply this times 512 bytes per sector and you get: 1,000,204,886,016 bytes (1TB) or just over 1 Trillion digits you can store. However if you put the period between each ACII character as you'd normally see in a TXT file, then you only get half that number or 500 billion digits.
 
Last edited:
If you were going to count the bytes and were counting 100 numbers per minute for 8 hours a day, 7 days a week it would take you 3 weeks to count a MB, 57 years to count a GB and 57,000 years to count a TB.
 
Just a few points that might make it easier to do such math.
  • Binary data (1's and 0's) are called bits (a single 0 or 1) and are stored in groups of 8 called a byte.
  • In a hex editor a byte is displayed as two Hex characters ranging from 0 to F. For example 0000 = 0, 0001 = 1, 1111 = F and there's two of them. So a single byte might look like 25, 11 , 2B, C0, 55, AA, etc. The lowest value is 00 and the highest is FF of a single byte.
  • A byte is then tranlated into a single ACII character of which there are 256 possibilities.
  • Bytes are stored in what's called a sector (typically 512 bytes each, but 4096 on newer drives)
Since you'd only need to be storing numbers, not actually letters, it is possible that each number could be recorded using just 4 bits and thus store two digits per byte. However most software wouldn't know how to work with data in this format, so let's just assume that you'd be recording it using a full byte (single ACII character) to store each number.

A typical 1TB WD HDD has 1,953,525,168 sectors. Multiply this times 512 bytes per sector and you get: 1,000,204,886,016 bytes (1TB) or just over 1 Trillion digits you can store. However if you put the period between each ACII character as you'd normally see in a TXT file, then you only get half that number or 500 billion digits.
I am familiar with all that, and if I were to want to store a huge number in a file I would be reluctant to even use 4 bits to store individual numbers, much less store it in UNICODE (the period between the characters is caused by using a 2 byte UNICODE format rather than a 1 byte ASCII format used to expand the character set for international use).

I can comprehend a terabyte. It's "a billion digits" I'm having trouble with. The whole terabyte conversation was me trying to shoehorn a number that big into a format I could understand. By my calculations, which may or may not be correct, it would take about 400MB of space just to store the nearly 414 MILLION bytes it would take to represent a single number that size in straight binary.

I still am not sure any of my math is correct, but I'm starting to get a grip on it, a little at least. But like I said, my brain works in funny ways. I obsess over something I simply MUST know more about and a month later I could not care less about it, so probably by the time I figure it out I won't care any more. But right now I'm in the "obsessing" stage.
 
All this talk about Pie is making me hungry.
By the way, you guys need to check the "e" key on your keyboards.
You keep typing Pi, without the e.
I think I'll have some Apple Pi, with Ice Cream, thank you very much.
LOL
 
Back
Top