Skip to content

Problem 29 – Distinct terms of sequence

May 14, 2010

Here is my solution for the 29th Euler problem:

import List

f = length $ nub [a^b | a <- [2..100], b <-[2..100]]

main = print f

Thanks to Haskell, it was relatively easy to solve. GHC’s execution time was:

real 0m0.650s
user 0m0.646s
sys 0m0.003s
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: