diff --git a/Lab6/dennis/Lab6.hs b/Lab6/dennis/Lab6.hs index fb5140d..fd72bca 100644 --- a/Lab6/dennis/Lab6.hs +++ b/Lab6/dennis/Lab6.hs @@ -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 {------------------------------------------------------------------------------ @@ -68,7 +68,7 @@ ass4 = do Assignment 5 - Hours spent: + Hours spent: 0.5 Answer: ------------------------------------------------------------------------------} @@ -90,12 +90,21 @@ 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 {------------------------------------------------------------------------------ @@ -103,4 +112,7 @@ ass5 = do Hours spent: Answer: -------------------------------------------------------------------------------} \ No newline at end of file + +------------------------------------------------------------------------------} + + diff --git a/Lab6/final/Assignment4.hs b/Lab6/final/Assignment4.hs index fafc32a..f2ceb8c 100644 --- a/Lab6/final/Assignment4.hs +++ b/Lab6/final/Assignment4.hs @@ -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 diff --git a/Lab6/final/Assignment5.hs b/Lab6/final/Assignment5.hs index 9029f36..a75b6b3 100644 --- a/Lab6/final/Assignment5.hs +++ b/Lab6/final/Assignment5.hs @@ -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. ------------------------------------------------------------------------------} diff --git a/Lab6/final/Assignment7.hs b/Lab6/final/Assignment7.hs index f4bacd5..33be910 100644 --- a/Lab6/final/Assignment7.hs +++ b/Lab6/final/Assignment7.hs @@ -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