Skip to content

Commit edaf627

Browse files
authored
Update README.md
1 parent 83aad28 commit edaf627

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,61 @@
1-
# FastModularExponentiation
1+
# Fast Modular Exponentiation
2+
3+
This repository contains a C# program for calculating the result of raising a base number to an exponent and then taking the modulus. The algorithm used is known as exponentiation by squaring, which is efficient and widely used in cryptographic applications.
4+
5+
## Technologies
6+
[<img align="left" alt="Csharp" width="36px" src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/csharp/csharp-original.svg" style="padding-right:10px;"/>][csharp]
7+
[<img align="left" alt="dotnet" width="36px" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Microsoft_.NET_logo.svg/2048px-Microsoft_.NET_logo.svg.png" style="padding-right:10px;"/>][dotnet]
8+
9+
[csharp]: https://en.wikipedia.org/wiki/C_Sharp_(programming_language)
10+
[dotnet]: https://en.wikipedia.org/wiki/.NET
11+
12+
<br>
13+
<br>
14+
15+
## Features
16+
17+
- **User Input**: Prompts the user to enter the base, exponent, and modulus.
18+
- **Efficient Algorithm**: Implements exponentiation by squaring.
19+
- **Detailed Output**: Displays intermediate steps and final result.
20+
- **Unit Tests**: Includes comprehensive unit tests to ensure correctness.
21+
22+
## Formula
23+
24+
The formula for modular exponentiation is:
25+
26+
$a^b \mod n$
27+
28+
where:
29+
- `a` is the base number,
30+
- `b` is the exponent,
31+
- `n` is the modulus.
32+
33+
34+
## How to Run
35+
36+
1. Clone the repository.
37+
2. Open the solution in Visual Studio or any C# IDE.
38+
3. Compile and run the program.
39+
4. Input the base number, exponent, and modulus when prompted.
40+
5. View the detailed output and final result on the console.
41+
42+
## Example Usage
43+
44+
```shell
45+
Enter a: 2
46+
Enter exponent: 10
47+
Enter modulo: 1000
48+
49+
i | x | a | t_i
50+
0 | 1 | 2 | 0
51+
1 | 1 | 4 | 1
52+
2 | 4 | 16 | 0
53+
3 | 4 | 256 | 1
54+
4 | 24 | 536 | -
55+
56+
Result: 24
57+
```
58+
59+
## License
60+
61+
This project is licensed under the [The MIT License](https://opensource.org/license/mit). See the LICENSE file for more details.

0 commit comments

Comments
 (0)