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 #7

Open
BertLisser opened this issue Oct 22, 2018 · 0 comments
Open

Lab 6 #7

BertLisser opened this issue Oct 22, 2018 · 0 comments

Comments

@BertLisser
Copy link

--ex5 (45 min)
carmichael :: [Integer]
carmichael = [ (6*k+1)*(12*k+1)*(18*k+1) |
          k <- [2..],
          prime (6*k+1),
          prime (12*k+1),
          prime (18*k+1)]

-- Al tested Carmichael numbers test true with Fermats primality test.
-- Carmichael numbers have the property we test with Fermats little theorem,
-- namely that if p is a prime number, then for any int b, the number b^p - b
-- is an int multiple of p.

Unclear report.
Why not taking k=1.
The question was what is the minimal Carmichael number which fools the test.

Exercise 6.
The following is a wrong conclusion.
The definition of ex6 must be parametrized by k. k=1,2,3.

-- All tested Carmichael numbers test false with MR primality test.
-- MR weeds out (most) Carmichael numbers because it also tests for a
-- non-trivial root of unity.
-- https://cs.stackexchange.com/questions/21462/why-miller-rabin-instead-of-fermat-primality-test

ex6 :: IO()
ex6 = ex6' carmichael

ex6' :: [Integer] -> IO()
ex6' (x:xs) = do
  print(x)
  res <- primeMR 10 x
  print(res)
  ex6' xs
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

1 participant