Search found 1 match

by lck
Thu Jul 27, 2006 6:54 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320852

100 in haskell

Why it take so long to calculate the answer in haskell while only one sec in c??

Code: Select all

f 1 = 1
f n = 1 +
    if even n
        then f $ div n 2
        else f $ n * 3 + 1
longCyLn i j = maximum $ map f [i..j]
putStrLn longCyLn 1 4000
:roll:

Go to advanced search