Fermat-FasterCoding-1.0.1
توضیحات
Example code for the Fermats-Little-Theorem modular inverse algorithm
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | Fermat-FasterCoding-1.0.1 |
| نام | Fermat-FasterCoding |
| نسخه کتابخانه | 1.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | FasterCoding |
| ایمیل نویسنده | fastercodingtutorial@gmail.com |
| آدرس صفحه اصلی | https://github.com/FasterCoding/Fermats-Little-Theorem |
| آدرس اینترنتی | https://pypi.org/project/Fermat-FasterCoding/ |
| مجوز | - |
# Fermats Little Theorem
This repository contains an example
of the Fermats Little Theorem algorithm
for C++ and one for Python3.
## C++
To run the example for C++
change into the `c++` folder
and run the following bash script in Linux.
```bash
mkdir build && \
cd build && \
cmake .. -G "Unix Makefiles" && \
make
```
The program should be build and
you can see an executable called `modinverse`.
You can test it with `./modinverse arg1 arg2`.
For example:
```bash
./modinverse 3 5
modular inverse of 3 mod 5 is 2
```
```bash
./modinverse 2 4
There is no modular inverse!
```
```bash
./modinverse 2
Not enough input arguments!
```
## Python3
You can run this example from source or
install it with pip and include it in your project.
### Source
**Requirement**
- virtualenv
To run this example from source,
run the following bash script in Linux.
```bash
python3 -m virtualenv . && \
source ./bin/activate && \
pip3 install -r requirements.txt
```
This will generate a virual environment and
install the requirement.
After that you can run the programm with
`python3 Fermat/fermat.py arg1 arg2`
For example:
```bash
python3 Fermat/fermat.py 2 5
The mod inverse of 2 mod 5 is 3
```
```bash
python3 Fermat/fermat.py 2 4
There is no modular inverse!
```
```bash
python3 Fermat/fermat.py 2
Not enough input arguments!
```
### Pip
To install this example with pip, simply run:
`pip3 install Fermat-FasterCoding`
Then you can use it as import like this:
```python
import Fermat.fermat as fermat
inverse = fermat.modInverse(3, 5) # This will return 2
```
نیازمندی
| مقدار | نام |
|---|---|
| - | Euclid-FasterCoding |
نحوه نصب
نصب پکیج whl Fermat-FasterCoding-1.0.1:
pip install Fermat-FasterCoding-1.0.1.whl
نصب پکیج tar.gz Fermat-FasterCoding-1.0.1:
pip install Fermat-FasterCoding-1.0.1.tar.gz