Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BertLisser opened this issue Oct 18, 2017 · 1 comment
Open

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

BertLisser opened this issue Oct 18, 2017 · 1 comment

Comments

@BertLisser
Copy link

BertLisser commented Oct 18, 2017

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
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants