You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Miller-Rabin Primality Test/README.markdown
+6-6
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ In 1976, Gray Miller introduced an algorithm, through his ph.d thesis[1], which
4
4
5
5
## Probabilistic
6
6
7
-
The result of the test is simply a boolean. However, `true` does not implicate *the number is prime*. In fact, it means *the number is **probably**prime*. But `false` does mean *the number is composite*.
7
+
The result of the test is simply a boolean. However, `true` does not implicate _the number is prime_. In fact, it means _the number is **probably**prime_. But `false` does mean _the number is composite_.
8
8
9
-
In order to increase the accuracy of the test, it needs to be iterated few times. If it returns `true` in every single iteration, than we can say with confidence that *the number is pro......bably prime*.
9
+
In order to increase the accuracy of the test, it needs to be iterated few times. If it returns `true` in every single iteration, than we can say with confidence that _the number is pro......bably prime_.
10
10
11
11
## Algorithm
12
12
@@ -16,7 +16,7 @@ Now make a sequence, in modulo `n`, as following:
And we say the number `n` passes the test, *probably prime*, if 1) `a^d` is congruence to `1` in modulo `n`, or 2) `a^((2^k)·d)` is congruence to `-1` for some `k = 1, 2, ..., s-1`.
19
+
And we say the number `n` passes the test, _probably prime_, if 1) `a^d` is congruence to `1` in modulo `n`, or 2) `a^((2^k)·d)` is congruence to `-1` for some `k = 1, 2, ..., s-1`.
20
20
21
21
### Pseudo Code
22
22
@@ -32,11 +32,11 @@ mrPrimalityTest(7, iteration: 10) // test if 7 is prime & iterate 10 times
32
32
```
33
33
34
34
## Reference
35
-
1. G. L. Miller, "Riemann's Hypothesis and Tests for Primality". *J. Comput. System Sci.* 13 (1976), 300-317.
36
-
2. M. O. Rabin, "Probabilistic algorithm for testing primality". *Journal of Number Theory.* 12 (1980), 128-138.
35
+
1. G. L. Miller, "Riemann's Hypothesis and Tests for Primality". _J. Comput. System Sci._ 13 (1976), 300-317.
36
+
2. M. O. Rabin, "Probabilistic algorithm for testing primality". _Journal of Number Theory._ 12 (1980), 128-138.
37
37
3. Miller–Rabin primality test - Wikipedia, the free encyclopedia
38
38
39
-
*Written for Swift Algorithm Club by **Sahn Cha**, @scha00*
39
+
_Written for Swift Algorithm Club by **Sahn Cha**, @scha00_
0 commit comments