An open API service indexing awesome lists of open source software.

https://github.com/elajbariyoussef/primechecker

A function that returns True if the input number is prime, False if not.
https://github.com/elajbariyoussef/primechecker

algorithm algorithms math mathematical-programming mathematics prime-numbers

Last synced: 3 months ago
JSON representation

A function that returns True if the input number is prime, False if not.

Awesome Lists containing this project

README

        

# PrimeChecker

A simple Python function that checks if an odd number is prime using a custom formula.

## How to Use

```python
from PrimeCheck import PrimeCheck

number = 17
is_prime = PrimeCheck(number) # Returns True
```

## How it Works

Uses the formula: `(((n-1)/2)-a) / ((2*a)+1)`
- If the formula ever results in a whole number, the input is not prime
- Otherwise, the number is prime