News for hackers. Stuff that matters.
Re:2^74207281-1 is Prime by coldpie on Tuesday January 19, 2016 @11:56AM (#10931947)
Big numbers are fun. Here's some stupid stuff I thought of while reading about this.

The number is 2^74,207,281 - 1. Naively stored like a normal integer in memory, that's roughly 75 MB of RAM just to store the number. Compare that to your 64-bit time_t and imagine how long a duration of time could be represented by such a large number. Stored on 3.5" floppy disks for some reason, that's roughly 50 disks just to store the number.

Edit: Duh, bits, not bytes. I leave my mistake here for posterity.

Re:2^74207281-1 is Prime by cousin_it on Tuesday January 19, 2016 @11:57AM (#10931960)
Not unless you gzip it. Since the number is just the binary 1 repeated a bunch of times, it should gzip pretty well.
Re:2^74207281-1 is Prime by biot on Tuesday January 19, 2016 @06:32PM (#10934955)
gzipped it's a 9043 byte file when the source is the number expressed exactly as bits. gzipping that 9043 byte file yields a 129 byte file, which gzip can't compress any further. Base64 of the file:

  H4sICBPHnlYCA2EuYmluegDt0LENQQEUQNHnK7xINF8rLIAVbKH88VU0ZlATK4gt1DQ6vURMoBID
  iN4CknOa29/BNrN72U+LZj2eL1fxPDU6EXE+3CbvUTEMAAAAAAAAAODfPfq9/DZfx6petw2B32Z5
  XZT31mYXH9vDv0RTIwAA
Re:2^74207281-1 is Prime by themadcreator on Tuesday January 19, 2016 @08:15PM (#10935378)
Neato! Verified with:

  echo "H4sICBPHnlYCA2EuYmluegDt0LENQQEUQNHnK7xINF8rLIAVbKH88VU0ZlATK4gt1DQ6vURMoBIDiN4CknOa29/BNrN72U+LZj2eL1fxPDU6EXE+3CbvUTEMAAAAAAAAAODfPfq9/DZfx6petw2B32Z5XZT31mYXH9vDv0RTIwAA" | base64 --decode | gzip -d | gzip -d | xxd
Re:2^74207281-1 is Prime by Houshalter on Tuesday January 19, 2016 @08:03PM (#10935335)
I see some redundancy there. The letter "A" appears many times in a row.

Also it could be compressed even further. All you need is a computer program that prints "1", 74 million times.

Re:2^74207281-1 is Prime by elenorelange on Tuesday January 19, 2016 @10:02PM (#10935796)
It's already been concisely expressed as 2^74,207,281 - 1, so you don't need a computer program that prints "1" 74 million times.

You just need a computer language that can interpret bignum math equations.

Re:2^74207281-1 is Prime by Houshalter on Tuesday January 19, 2016 @10:29PM (#10935882)
That would take ages to compute. Printing one is faster. And might produce the smallest file size if it's done in assembly.
Re:2^74207281-1 is Prime by elenorelange on Wednesday January 20, 2016 @01:07AM (#10936333)
but the metric was the most concise way to store the data
Re:2^74207281-1 is Prime by rom1504 on Tuesday January 19, 2016 @12:22PM (#10932150)
So I tried it and it's 72135 bytes using tar czf (created by `fs.writeFileSync('/tmp/file',new Buffer(74207281).fill("1"),'utf8')`)

Not that it's the most efficient representation at all, 74207281 fits in 4 bytes.

Re:2^74207281-1 is Prime by dchest on Tuesday January 19, 2016 @01:08PM (#10932537)
This thread is officially dumb. One guy miscalculates 75 Mbit as ~75 MiB, another guy fills ~70 MiB file with ASCII "1"s.
Re:2^74207281-1 is Prime by yitchelle on Tuesday January 19, 2016 @02:16PM (#10933133)
Strange but very useful things could emerge from just mucking about and poking around...
Re:2^74207281-1 is Prime by dchest on Tuesday January 19, 2016 @03:28PM (#10933725)
Hehe, I didn't mean to sound negative! Agree with the other poster that it's quite fun.

Oh, and I also forgot to mention that the guy used `tar` for compressing one file. I'll see myself out.

Re:2^74207281-1 is Prime by coldpie on Tuesday January 19, 2016 @09:20PM (#10935634)
I'm glad I started this stupid thread, and this is my favorite comment in it.
Re:2^74207281-1 is Prime by banku_brougham on Tuesday January 19, 2016 @01:20PM (#10932647)
dumb, but fun
Re:2^74207281-1 is Prime by daveguy on Tuesday January 19, 2016 @12:56PM (#10932438)
M49 (for the 49th mersenne prime) fits in 2 bytes! Or even better just 49! 6 bits! Assuming your decompression algorithm is optimized for mersenne primes. :)
Re:2^74207281-1 is Prime by alasdair_ on Tuesday January 19, 2016 @03:06PM (#10933547)
It can fit in a single bit if your algorithm is optimized for "primes that are equal to M49" :)
Re:2^74207281-1 is Prime by lakofsth on Tuesday January 19, 2016 @05:09PM (#10934490)
You could optimize the single bit away by assuming that there would be a bit.
Re:2^74207281-1 is Prime by ekimekim on Tuesday January 19, 2016 @09:40PM (#10935724)
Re:2^74207281-1 is Prime by graylights on Tuesday January 19, 2016 @09:33PM (#10935700)
Great, I've just discovered the 50th mersenne prime, M50. Decompression takes a lot of time.
Re:2^74207281-1 is Prime by yen223 on Tuesday January 19, 2016 @12:04PM (#10932011)
Repeated exactly 74,207,281 times, to be precise...
Re:2^74207281-1 is Prime by seibelj on Tuesday January 19, 2016 @12:09PM (#10932054)
No, the number 5 is prime, yet in binary it is 101. The new prime number could have many zeroes interspersed with ones, so you don't know how many 1 digits it has.

EDIT: I have realized my mistake in the representation of 2's complement. However, I will leave this here for posterity.

Re:2^74207281-1 is Prime by gill984 on Tuesday January 19, 2016 @12:26PM (#10932190)
It's a Mersenne Prime, so it is 1 less than some power of 2. This results in all of its non-leading digits in binary being 1s.
Re:2^74207281-1 is Prime by theandrewbailey on Tuesday January 19, 2016 @12:25PM (#10932185)
But 5 is not 2^n-1
Re:2^74207281-1 is Prime by eggy on Tuesday January 19, 2016 @03:25PM (#10933697)
5 is a prime number true, but not a Mersenne prime number. The Mersenne prime number 31 has 5 as its exponent n [1].

[1] http://mathworld.wolfram.com/MersennePrime.html

Re:2^74207281-1 is Prime by PeCaN on Tuesday January 19, 2016 @12:09PM (#10932057)
Turns out run-length encoding it is more or less what you get if you store it as 2^74,207,281 - 1. I imagine this probably is how they store it actually; note that 2^n == 1<<n so you can just store the exponent and complement (74 207 281, 1) and then do normal two's complement math.
Re:2^74207281-1 is Prime by kale on Tuesday January 19, 2016 @02:17PM (#10933146)
If you're talking about storing it in computer memory during calculation, then no, it's written out. The fast MOD operation you list isn't used, it's an FFT using a weight factor that automatically does the mod operation while squaring a number. You start with S[0] = 4, S[i+1] = Si^2 - 2 MOD N. If S[N-2] = 0 then the number is prime.

So it's 74,207,279 squares using FFT, each likely more than 75 MiB since there will likely be lots of leading zeros (we're probably close to the maximum number of digits using double precision, round off errors dominate unless you start using really small bases and even greater-length FFTs).

That's not counting the two or three compositeness tests that GIMPS uses before starting the Lucas-Lehmer test to prove primality.

For several years I've been working on a program to test for primality of the Generalized Fermat numbers, using NTT instead of FFT. NTT is exact (integer math), and the GFNs likely are more "dense" with primes than the Mersenne Numbers. And they also have a faster form to test, although the primality test has a 50% chance of false negative, so you have to run it a few times to be sure a number isn't prime. That's where Mersenne Numbers are easier to test.

Re:2^74207281-1 is Prime by Dylan16807 on Tuesday January 19, 2016 @05:02PM (#10934441)
It's the sort of thing that's so repetitive you end up gzipping the gzip, because the "repeat N times" code doesn't support going so high.
Re:2^74207281-1 is Prime by Someone on Tuesday January 19, 2016 @12:26PM (#10932193)
75 Megabits; 9.5 MB/7 3.5" floppies/5-10 selfies.
Re:2^74207281-1 is Prime by coldpie on Tuesday January 19, 2016 @12:36PM (#10932272)
You're right! Thanks! I told you it was stupid :P
Re:2^74207281-1 is Prime by DonHopkins on Tuesday January 19, 2016 @01:19PM (#10932634)
How many t-shirts?
Re:2^74207281-1 is Prime by ctdonath on Tuesday January 19, 2016 @01:49PM (#10932904)
Someplace used to print Mersenne primes as posters. IIRC they were using a font around 2 points. Probably given up now...
Re:2^74207281-1 is Prime by ribasushi on Tuesday January 19, 2016 @06:59PM (#10935071)
The person died, and the art with him :( http://www.mersenneforum.org/showthread.php?t=19100
Re:2^74207281-1 is Prime by sanoli on Tuesday January 19, 2016 @07:57PM (#10935314)
I remember those. They either came with a loupe, or mentioned explicitly to the buyer that you needed one to see individual numbers. Always wanted to get one. It looked like an all grey poster if you didn't know what it was.
Re:2^74207281-1 is Prime by logicallee on Tuesday January 19, 2016 @12:32PM (#10932247)
75 MB compresess neatly to under 12 bytes, which I say because the string "2^74207281-1" is totally unambiguous (Wolfram Alpha will evaluate it for you no questions asked, no guesswork, though obviously it only approximates the output). So the Kolmogorov complexity of the 75 MB is 96 bits or less.
Re:2^74207281-1 is Prime by gambogi on Tuesday January 19, 2016 @12:11PM (#10932067)
Looks like you just communicated it in 16 bytes though.
Re:2^74207281-1 is Prime by J_Darnley on Tuesday January 19, 2016 @03:17PM (#10933638)
It is far too many bits to be used for time representation. 512 bits is all that needed to store every planck time (10^-44 seconds) since the big bang until the heat death of the universe (10^100 years).
Re:2^74207281-1 is Prime by PhasmaFelis on Tuesday January 19, 2016 @10:10PM (#10935819)
Sure, that's fine if all you want is to measure the time from the big bang until the last matter in the universe has evaporated into photon soup. But what if you want the time until those photons are evenly distributed? An article I read a while back estimated that duration as 10^10^78 years, which is absolutely mindboggling and remains the largest number I have ever seen with a real-world physical application.

(It may never happen, though; according to Wikipedia, random quantum fluctuations may be sufficient to produce another Big Bang in a mere 10^10^56 years.)

Re:2^74207281-1 is Prime by firethief on Tuesday January 19, 2016 @10:50PM (#10935951)
That makes sense for durations, but a time_t is actually a timestamp. A proper time can have the same units as a duration, but is only useful in conjunction with information about the trajectory of the clock measuring the time. If space is continuous, the amount of information to specify the trajectory is limited only by the capabilities of the measurement apparatus. Of course, for all we know at this point spacetime is quantized; so we should probably hold off on standardizing the time format to end all time formats.
Re:2^74207281-1 is Prime by batbomb on Tuesday January 19, 2016 @02:46PM (#10933400)
Or you create a new compression scheme just for Mersenne prime numbers where store the exponent. You'll be able to compress the entire number into just 32 bits for several decades at least!
Re:2^74207281-1 is Prime by hinkley on Tuesday January 19, 2016 @05:17PM (#10934547)
Since the exponent is prime you should be able to compress it further than that, by simply noting n is the kth prime number. Supposedly as n goes to infinity the probability that n is prime drops to zero, so that should compress handily.

Decompressing it, on the other hand, would be pretty slow however. Are primality tests O(n) or O(nlogn)? That puts decompression up to O(n^2) without a pre computed lookup table.

Re:2^74207281-1 is Prime by CUViper on Tuesday January 19, 2016 @06:38PM (#10934982)
https://en.wikipedia.org/wiki/Prime_number_theorem#Approxima...

So with the kth prime ~= k log k, the ratio of primes is 1 / log k. Yes that drops to zero, but very slowly.

You can use the upper bound of the kth prime to build a sufficiently large sieve, which can be done O(n).

Re:2^74207281-1 is Prime by spacehome on Wednesday January 20, 2016 @01:17AM (#10936356)
If you don't care about computation time, then why stop there?

You can encode the Mth Mersenne with the integer M.

Re:2^74207281-1 is Prime by hinkley on Wednesday January 20, 2016 @01:55PM (#10940399)
But then I have to keep patching the code every time a new one comes out. Too hard!
Re:2^74207281-1 is Prime by spacehome on Wednesday January 20, 2016 @10:45PM (#10943221)
You don't. You can write a program that converts between m and M_m. It just takes a long time to convert.
Re:2^74207281-1 is Prime by analog31 on Tuesday January 19, 2016 @01:46PM (#10932875)
I think there's a related mathematical paradox about the largest number that can be represented by an English phrase of fewer than 93 characters.
Re:2^74207281-1 is Prime by frandroid on Tuesday January 19, 2016 @12:22PM (#10932149)
That's 75 megabits, not megabytes.