Skip to content

Problem 97 – Last 10 digits of prime number

May 14, 2010

Thanks to the beauty of Haskell, the 97th Euler problem was easy to solve:

last10digits = non_mersenne_prime `mod` 10^10
  where non_mersenne_prime = 28433 * 2^(7830457)+1

main = print last10digits

It was also quite fast (in GHCi):

(0.40 secs, 29534168 bytes)

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: