|
4 | 4 | // |
5 | 5 | // "A quantum-inspired Monte Carlo integer factoring algorithm" |
6 | 6 | // |
7 | | -// This library was originally called ["Qimcifa"](https://github.com/vm6502q/qimcifa) and demonstrated a (Shor's-like) "quantum-inspired" algorithm for integer factoring. It has |
8 | | -// since been developed into a general factoring algorithm and tool. |
9 | | -// |
10 | | -// `FindAFactor` uses heavily wheel-factorized brute-force "exhaust" numbers as "smooth" inputs to Quadratic Sieve, widely regarded as the asymptotically second fastest algorithm |
11 | | -// class known for cryptographically relevant semiprime factoring. `FindAFactor` is C++ based, with `pybind11`, which tends to make it faster than pure Python approaches. For the |
12 | | -// quick-and-dirty application of finding _any single_ nontrivial factor, something like at least 80% of positive integers will factorize in a fraction of a second, but the most |
13 | | -// interesting cases to consider are semiprime numbers, for which `FindAFactor` should be about as asymptotically competitive as similar Quadratic Sieve implementations. |
14 | | -// |
15 | | -// Our original contribution to Quadratic Sieve seems to be wheel factorization to 13 or 17 and maybe the idea of using the "exhaust" of a brute-force search for smooth number |
16 | | -// inputs for Quadratic Sieve. For wheel factorization (or "gear factorization"), we collect a short list of the first primes and remove all of their multiples from a "brute-force" |
17 | | -// guessing range by mapping a dense contiguous integer set, to a set without these multiples, relying on both a traditional "wheel," up to a middle prime number (of `11`), and a |
18 | | -// "gear-box" that stores increment values per prime according to the principles of wheel factorization, but operating semi-independently, to reduce space of storing the full |
19 | | -// wheel. |
20 | | -// |
21 | | -// Beyond this, we gain a functional advantage of a square-root over a more naive approach, by setting the brute force guessing range only between the highest prime in wheel |
22 | | -// factorization and the (modular) square root of the number to factor: if the number is semiprime, there is exactly one correct answer in this range, but including both factors in |
23 | | -// the range to search would cost us the square root advantage. |
24 | | -// |
25 | | -// Factoring this way is surprisingly easy to distribute: basically 0 network communication is needed to coordinate an arbitrarily high amount of parallelism to factor a single |
26 | | -// number. Each brute-force trial division instance is effectively 100% independent of all others (i.e. entirely "embarrassingly parallel"), and these guesses can seed independent |
27 | | -// Gaussian elimination matrices, so `FindAFactor` offers an extremely simply interface that allows work to be split between an arbitrarily high number of nodes with absolutely no |
28 | | -// network communication at all. In terms of incentives of those running different, cooperating nodes in the context of this specific number of integer factoring, all one |
29 | | -// ultimately cares about is knowing the correct factorization answer _by any means._ For pratical applications, there is no point at all in factoring a number whose factors are |
30 | | -// already known. When a hypothetical answer is forwarded to the (0-communication) "network" of collaborating nodes, _it is trivial to check whether the answer is correct_ (such as |
31 | | -// by simply entering the multiplication and equality check with the original number into a Python shell console)! Hence, collaborating node operators only need to trust that all |
32 | | -// participants in the "network" are actually performing their alloted segment of guesses and would actually communicate the correct answer to the entire group of collaborating |
33 | | -// nodes if any specific invidual happened to find the answer, but any purported answer is still trivial to verify. |
| 7 | +// Special thanks to https://github.com/NachiketUN/Quadratic-Sieve-Algorithm, for providing an example implementation of Quadratic sieve. |
34 | 8 | // |
35 | 9 | //**Special thanks to OpenAI GPT "Elara," for indicated region of contributed code!** |
36 | 10 | // |
37 | | -// Licensed under the GNU Lesser General Public License V3. |
| 11 | +// Licensed under the MIT License. |
38 | 12 | // See LICENSE.md in the project root or |
39 | | -// https://www.gnu.org/licenses/lgpl-3.0.en.html for details. |
| 13 | +// https://opensource.org/license/mit for details. |
40 | 14 |
|
41 | 15 | #include "dispatchqueue.hpp" |
42 | 16 |
|
|
0 commit comments