Skip to content

Problem 30 – sum of all the numbers that can be written as the sum of fifth powers of their digits.

May 14, 2010

Again, as in the problem 29, there is not a big deal about the 30th Euler problem:

import Char

f = sum [x | x <- [2..10^6], g x == x]
  where g = sum . map (^5) . map digitToInt . show

main = print f

The execution time was:

real 0m2.494s
user 0m2.482s
sys 0m0.011s
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: