Friday, August 31, 2012

Project Euler 97

Project Euler 97, find the last ten digits of 28433×2^7830457+1.


Oh gods this is embarrassing.

I spent the longest time wondering what was wrong with this:

theprime = 28433 * (2^7830457)+1
last10 = take 10 $ reverse $ show theprime
main = print last10

And now I know! I got all the right digits, but in the wrong order because I initially reversed number. (Is this another one of those problems that can be optimized? Unsure how I would go about that….)

Posting this one so I don't forget how silly I am!

No comments:

Post a Comment