-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.pre
91 lines (69 loc) · 2.67 KB
/
README.md.pre
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Arithmetic Congruence Monoid
============================
[](https://crates.io/crates/acm)
[](https://docs.rs/acm)
Implements [arithmetic congruence monoids][math-acm] (ACM) in Rust.
[math-acm]: http://faculty.fairfield.edu/pbaginski/Papers/SubmittedACMSurvey%20RevisedReferee%2001.20.2013.pdf
In a nutshell, an ACM is an arithmetic progression which possesses a
multiplicative structure, and specifically is the monoid:
$$
M_{a,b}=\{a+bm:m\in\mathbb{Z}_{\ge 0}\}\cup\{1\}=\{1,a,a+b,a+2b,\ldots\}
$$
With $a=1$ and $b=4$ we get a Hilbert monoid:
$$
M_{1,4}=\{1+4m:m\in\mathbb{Z}_{\ge 0}\}\cup\{1\}=\{1,5,9,13,17,\ldots\}
$$
Over an ACM, we can factor integers into elements of the ACM. This is similar to
simple prime factorization except that each factor must be an element of the
ACM. We call elements which cannot be expressed as the product of smaller ACM
elements *atoms*.
Finally, the purpose of this library is to study the atomic density of different
ACMs, that is, the distance between atoms. In certain ACMs the atomic density is
provably constant throughout, but in others it is unknown; not dissimilar to the
density, or lack thereof, of prime integers in the set of all integers.
This project started as [a C++ port][acm-cpp] of [acm-sage], but my interest in
Rust led me to rewrite the project.
[acm-cpp]: https://github.com/nilsso/acm-cpp
[acm-sage]: https://github.com/coneill-math/acm-sage
## CLI
Provided is an example CLI program `acm-cli` with subcommands to test the main ACM module and the
divisors/factorize submodules.
```
> cargo r --example acm-cli factor 225
(3,2),(5,2)
> cargo r --example acm-cli acm 3 6 factor 225
[15,15],[3, 75]
```
For usages use the <kbd>-h</kbd> flag.
```
> cargo r --example acm-cli -h
USAGE:
acm-cli <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
acm ArithmeticCongruenceMonoid subcommand
divisors Integer divisors subcommand
factorize Integer factorization subcommand
help Prints this message or the help of the given subcommand(s)
> cargo r --example acm-cli acm factor -h
ACM atom factorizations of an integer
USAGE:
acm-cli acm <a> <b> factor <n>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<n> Integer to factor
```
## Documentation
Build all documentation locall and open in your browser:
```
RUSTDOCFLAGS="--html-in-header katex-header.html" cargo doc --no-deps --open
```
## Tests
To run all tests, including documentation tests:
```
cargo t
```