Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
djspaan committed Oct 17, 2018
1 parent 245de03 commit bcfd2ad
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
22 changes: 17 additions & 5 deletions Lab6/dennis/Lab6.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exM b e m = t * exM ((b * b) `mod` m) (shiftR e 1) m `mod` m where t = if testBi
--sys 0m0,004s

-- time ./testNormal
-- doesn't finish within a minute
-- Doesn't finish within a minute

{------------------------------------------------------------------------------
Expand Down Expand Up @@ -68,7 +68,7 @@ ass4 = do
Assignment 5
Hours spent:
Hours spent: 0.5
Answer:
------------------------------------------------------------------------------}

Expand All @@ -90,17 +90,29 @@ ass5 = do
Assignment 6 1
Hours spent:
Hours spent: 0.5
Answer:
These tests do not finish within 5 minutes.
------------------------------------------------------------------------------}

testMillerRubin k (x:xs) = do
failureFound <- primeMR k x
if failureFound then print $ x else testMillerRubin k xs


ass61 = do
testMillerRubin 1 carmichael
testMillerRubin 2 carmichael
testMillerRubin 3 carmichael
testMillerRubin 4 carmichael
testMillerRubin 5 carmichael

{------------------------------------------------------------------------------
Assignment 6 2
Hours spent:
Answer:
------------------------------------------------------------------------------}
------------------------------------------------------------------------------}


4 changes: 2 additions & 2 deletions Lab6/final/Assignment4.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import Assignment3
As k increases the found composites are larger.
This is because for a sample of k possible fermat witnesses the possibility
of all of them beign fermat liars is LEQ 2^-k probability.
Give a large enough k this probability aproximates zero.
of all of them being fermat liars is LEQ 2^-k probability.
Give a large enough k this probability approximates zero.
------------------------------------------------------------------------------}

testFermat k (x:xs) = do
Expand Down
2 changes: 1 addition & 1 deletion Lab6/final/Assignment5.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Assignment4
of carmichael's composite numbers.
This is easy to explain since this list of carmichael is the exact counter for the Fermat theorem.
On Wikipedia they call it the Fermat pseudoprimes for this reason. This means that every number in the list
On Wikipedia they call it the Fermat pseudo-primes for this reason. This means that every number in the list
is set to fool the Fermat theorem and thus is the first in this list always the first counterexample.
------------------------------------------------------------------------------}
Expand Down
2 changes: 1 addition & 1 deletion Lab6/final/Assignment7.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Output:
"Decoded message: 123456789"
------------------------------------------------------------------------------}

-- Returns a prima value in the range
-- Returns a prime value in the range
-- between 2^(n-1) and 2^(n)
genNBitPrime :: Int -> IO (Integer)
genNBitPrime n = do
Expand Down

0 comments on commit bcfd2ad

Please sign in to comment.