Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Haskell hacking
[go: Go Back, main page]


Haskell Hacking: a journal of Haskell programming



2008-09-30

Newest Mersenne Prime

Thanks to Ward Harold for the heads up about UCLA's new mersenne prime discovery.

With Haskell's default unbounded Integer type, you can have a look at this beast with little effort. Here's the Haskell program to print the prime to stdout:

    main = print (2^43112609-1)

Compile and run this program:

    $ ghc -O2 --make A.hs
    $ time ./A > /tmp/prime.txt
    ./A > /tmp/prime.txt  34.14s user 0.23s system 99% cpu 34.462 total

And we get a 13M file containing 31647026933025592314 ... 78265780022181166697152511. Enjoy!

/home :: /haskell :: permalink :: rss

About

Real World Haskell

RWH Book Cover

Archives

Recommended

Blog Roll

Syndicate