Skip to content

Commit

Permalink
chore: update readme with new todos and features
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law committed May 22, 2024
1 parent 48ec864 commit 94b3912
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# primality

Primality is a Golang library for determining whether any given integer $i\in
\mathbb{Z}^+,~i\ge1$. The library provides two implementations of algorithms for
determining the primality of an arbitrarily sized integer, using the `math/big`
Primality is a Golang library for determining whether any given integer
$i\in\mathbb{Z}^+,~i\ge1$. The library provides two implementations of algorithms
for determining the primality of an arbitrarily sized integer, using the `math/big`
library.

The two methods provided are the Miller-Rabin and AKS primality test the former
Expand All @@ -16,20 +16,25 @@ integers.
### Miller-Rabin:

- Highly accurate probabilistic primality test
- 25 rounds and force usage of base 2 recommended
- 25 rounds and force usage of base 2 recommended for near 100% accuracy
- Arbitrarily large integer support (`big.Int`)
- $\mathcal{O}(r\cdot s)$ time complexity (assuming `big.Int` operations are
$\mathcal{O}(1)$ where $r$ is the number of repetitions and $s$ the number of
trailing zeros on $n$, the number being tested - otherwise it is related to
the operations of `big.Int` integers and $n$ itself.
- As a prime must be odd $s\le7$ meaning the time complexity in its worst case
is $\mathcal{O}(175)=\mathcal{O}(1)$ with 25 repetitions.

### AKS

- Deterministic primality test
- Slow on larger integers
- Slow overall - but guarantees 100% a valid outcome
- `int` support only

## TODOs

- Fix false positives with AKS method
- Add unit tests
- Improve speed of the AKS method
- Specifically step 5
- Specifically step 5 but overall it is slow
- Make the AKS method work on arbitrarily sized integers
- use `big.Int`s over `int`s
- Determine the true time and space complexities for both methods

0 comments on commit 94b3912

Please sign in to comment.