online advertising

Tuesday, June 9, 2015

Haskell 99 Problem 31


Please find the problem here.


Please see the solution as follow:

A simple brute force prime detector - test up to ceiling of square root. There are faster prime detection algorithm, but with the input range I am interested in I don't need it right now. Be careful with invalid inputs and the special case for 2. Ceiling of square root of 2 is 2 and we should not test 2 % 2.

Wonder where is problem 29 and 30? There are no such problems! There are gaps in the Haskell 99 problems.

No comments :

Post a Comment