This goes into an infinite loop on tryhaskell.org. I am not sure why.
last $ filter (<100) $ [2..] >>= (\a -> if 0 == (length $ filter (== 0) $ map (mod a) $ [2..a-1]) then (return a) else [])
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not refusing to be lazy, it’s just there’s no way for it to know that after you get all the primes < 100, there aren’t any more.
What if the sequence looked like
1, 2, … 99, 100, 101, 102, 5, 103, …
In other words,
lastcan’t predict the future. Oh how I wish.