Commit Graph
8 Commits
Author SHA1 Message Date
Chip Hogg cfd9ddb675 Add Miller-Rabin probable prime test
This can mark a number as either "probably prime", or "definitely
composite".  The first parameter is the base, and the second is the
number to test.

Future PRs will build up the Strong Lucas test which complements this,
and then form the Baillie-PSW test by composing the two.

Helps #506.
2024-11-13 19:56:05 -05:00
Chip Hogg 8a7483f7ea Add helpers for modular arithmetic
The prime-testing techniques we will use (Miller-Rabin, Strong Lucas)
all make heavy usage of modular arithmetic.  Therefore, we lay those
foundations here, adding utilities to perform the basic arithmetic
operations robustly.

Since these are internal-only helper functions, we don't bother checking
the preconditions, although we state them clearly in the contract
comment for each utility.  After C++26, we could add contracts for
these.

Helps #509.
2024-11-11 12:55:41 -05:00
Mateusz Pusz b870b85c25 feat: import std; support added
Resolves #595
2024-07-16 17:36:00 +02:00
Mateusz Pusz f49b4c6f5f refactor: compile-time optimizations reverted 2024-06-14 13:37:56 +02:00
Mateusz Pusz e38c7c4460 refactor: magnitudes support refactored to improve compile-times 2024-06-06 20:58:15 +02:00
Mateusz Pusz c066104af7 refactor: 💥 framework.h introduced + IWYU 2024-04-24 21:09:29 +02:00
Mateusz Pusz 5ca9168381 feat: proper exports implemented for C++ modules 2024-02-23 21:09:17 +01:00
Mateusz Pusz 0eaf6e2e56 refactor: modules support redesigned 2024-01-06 08:51:01 +01:00