software-engineering-amsterdam / ST2017_WG_14

0 stars 1 forks source link

Lab 6: 6a, 6b, 7 #9

Open BertLisser opened 7 years ago

BertLisser commented 7 years ago

Clear structured code. 6a

Report incomplete 6a(<-7)

6b

-- =============================================================================
-- Exercise 6 (2) :: Time spent: +- 1 hour
-- Finding a list of mersenneprimes
-- Using the miller rabin primes, this is much faster than the algorithm using the normal prime
-- =============================================================================
exercise62 = do
 putStr "Comparing first 10 mersenne primes: "
 calculatedPrimes <- filterM (primeMR 1.(\x -> (2^x) - 1)) $ take 150 primes
 let primeValues = map mersenne calculatedPrimes
 print $ take 10 primeValues == take 10 knownMersennePrimes
 putStrLn ""

-- | Known mersenne Numbers
knownMersennePrimes :: [Integer]
knownMersennePrimes = [ mers n | n <- [1..25]]

Report is incomplete. No answer for the question: Check whether the numbers that you found are genuine Mersenne primes. 6b (<-5)

7 (<-10)

wjglerum commented 7 years ago

@BertLisser thanks for the feedback.

For 6a we print the report in the console:

> Exercise 6 (1)
 Exercise 6: Smallest number in J. Chernick's subset of carmichael numbers that passes Miller-Rabin
K = 1, minimum 'prime': 9624742921 can be divided by [1171,2341,3511], average value of primes found: 9624742921
K = 2, minimum 'prime': 1343656902505249 can be divided by [60727,121453,182179], average value of primes found: 1343656902505249
K = 5, minimum 'prime': 14199746960672563681 can be divided by [1332631,2665261,3997891], average value of primes found: 14199746960672563681

For 6b we check the first 10 mersenne numbers here: https://github.com/software-engineering-amsterdam/ST2017_WG_14/blob/master/Lab6/Final/Exercises.hs#L250 which we print as a result in the terminal as a report:

> Exercise 6 (2)
Comparing first 10 mersenne primes: True