From 3221b5c1dbd5de8a7d3d4ba79dc5596993479d47 Mon Sep 17 00:00:00 2001 From: EricSzla Date: Tue, 31 Oct 2017 11:27:24 +0000 Subject: [PATCH] README.md --- MillerRabin/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 MillerRabin/README.md diff --git a/MillerRabin/README.md b/MillerRabin/README.md new file mode 100644 index 0000000..5c22c08 --- /dev/null +++ b/MillerRabin/README.md @@ -0,0 +1,19 @@ +# Miller-Rabin algorithm + +## Description. +An algorigthm to check if a given number ``n`` is prime.
+If the algorithm returns inconclusive, it means that ``n`` is not prime,
+otherwise if algorithm returns composite, it means that ``n`` might be prime. + +### PseudoCode + +``` +Test(n) +1. Find integers k, q, with k > 0, q odd, so that (n - 1 = (2^k)q; +2. Select a random integer a, 1 < a < n - 1; +3. If (a^q)mod n == 1 then return ("inconclusive"); +4. For j = 0 to k - 1 do +4.1 If (a^(2^j)q)mod n = n - 1 then return ("inconclusive"); +5. Return ("composite"); +``` +