Very long integer class TInteger with various methods of multiplying methods, primality checking methods and other, in C++.
- Arithmetic:
+
-
*
/
%
- Comparison:
==
!=
>
>=
<
<=
- Type conversion:
std::string
int
- Ostream/cout
<<
- Karatsuba multiplication method
- Tom-Cook multiplication method
- The Best Multiplication Method Ever 🤩 (WOW)
- Newton's inverse method
- Fermat primality check method
- Rabin-Miller primality check method
- Solovay-Strassen primality check method
- Agrawal-Kayal-Saxena primality check method
To build an executable for 64-bit Windows, I used MinGW w64 9.0 and CMake 3.23.2. More
The app takes arguments from a shell.
Usage: integer.exe [number of a method] [first integer] {second integer}
Numbers of the methods:
0
- Output the given integers1
- Karatsuba multiplication method2
- Tom-Cook multiplication method5
- Newton's inverse method7
- Fermat primality check method8
- Rabin-Miller primality check method9
- Solovay-Strassen primality check method10
- Agrawal-Kayal-Saxena primality check method11
- Sum12
- Subtraction13
- Multiplication "in column"14
- Division15
- Remainder from division16
- The Best Multiplication Method Ever 🤩 (WOW)
This repository also contains a testing script in Python that runs all methods with random numbers, compares the results with python's fast and (I hope) correct results. To use this script, you need to install sympy
(or remove the parts of the script that tests the primality check methods). After running the script, you can check a report in test.txt
, where you can find out if the test was passed, its inputs and outputs and how much time it took to finish.