FerryRiet / SE-Testing

Software engineering 2013-2014: Software Specification and Testing:
0 stars 1 forks source link

Week 6: if you have read this and you have no questions, please close this issue. #3

Closed BertLisser closed 11 years ago

BertLisser commented 11 years ago

The following is a nice straight-forward solution, but it is not very efficient.

composites :: [Integer]
composites = composites' [4..]
composites' (n:ns) = n : composites'
   (filter (\ m -> head (factors m) /= m) ns)

The question was What is the least composite number that you can find that fools the check, for testF k with k=1,2,3. Your answered with a function testF with no parameter k. In your case k is fixed with 10.

testF :: [Integer] -> IO ()
testF [] = print "All done."
testF (k:ks) = do
        isP <- primeF 10 k
        if isP then do
                print (show k ++ " is marked as prime!")
                testF ks
        else do
                --print (show k ++ " is a not prime!")
                testF ks
        --where isP = prime_test_F' k

The results must be mentioned more clearly. For example:

 3,
7,
31,
127,
8191,
131071,
524287,
2147483647,
2305843009213693951,
618970019642690137449562111,
162259276829213363391578010288127,

why not mentioning p instead of m in the case of Mersenne Primes

ruudvanderweijde commented 11 years ago

Yes, p was probably better. At first, I returned p and tested lookup the mersenne numbers up on wikipedia and found different numbers. I noticed that I was displaying p instead of the mersenne numbers. Displaying both of them would have been better.