Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctronp/prime_worker
web api to Verify Prime numbers with 64 iterations of miller rabin test.
https://github.com/ctronp/prime_worker
primality-test prime-numbers rust
Last synced: 24 days ago
JSON representation
web api to Verify Prime numbers with 64 iterations of miller rabin test.
- Host: GitHub
- URL: https://github.com/ctronp/prime_worker
- Owner: ctronp
- Created: 2021-12-30T20:51:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-11T04:15:23.000Z (over 2 years ago)
- Last Synced: 2024-04-24T05:25:03.440Z (9 months ago)
- Topics: primality-test, prime-numbers, rust
- Language: Rust
- Homepage:
- Size: 3.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prime Worker
REST API that validates if values are strings.
## Usage
### endpoint: ```/primes```
payload:
```json
{
"values": [
"1",
"2",
"3",
"1000001"
]
}
```### endpoint: ```/```
works as health path. doesn't require validation
## Environment variables
- PORT: port where the app will run, default:```8080```
- MAX_LEN: maximum quantity of digits of the numbers to test, default:```200```
- SECRET_HEADER: header to validate the requests, default:```Secret```
- SECRET: secret_header value to validate the request, default:```SecretStringExample1111000011110000```## Return
return the numbers as keys and the result as value:
(1)key: (2)value
1. an input value
2. if it's prime ("Yes", "No", "Probably")### Example:
#### input:
The Json can have at most 20 values.
```json
{
"values": [
"1",
"2",
"3"
]
}
```#### output:
```json
{
"1": "No",
"2": "Yes",
"3": "Yes"
}
```### Probably result
if the result is ```Probably``` it means that it passed 64 iterations
of Miller Rabin primality test.The probability of the number not being a prime is $\ \frac{3}{4}^{64} = 10^{-8} $