Metadata-Version: 2.3
Name: primeforge
Version: 1.0.0
Summary: PrimeForge - A Python module for working with prime numbers.
Author-email: Rishikesh <rishikeshprog@gmail.com>
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: MIT License

# PrimeForge

A Python module for working with prime numbers. This module provides various functions to generate, check, and manipulate prime numbers.

## Installation

You can install this module using:

```sh
pip install primeforge
```

## Features

- Generate prime numbers within a range
- Check if a number or a sequence of numbers are prime
- Find the next or previous prime number
- Generate random prime numbers
- Find the prime factors of a number
- Remove or filter prime numbers from a sequence

## Usage

### Importing the module
```python
from primeforge import *
```

### Functions

#### `primes(start: int, stop: int) -> list`
Returns a list of prime numbers in the range `[start, stop)`.
```python
primes(10, 30)  # [11, 13, 17, 19, 23, 29]
```

#### `copyprimes(seq: list) -> list`
Returns a list containing only the prime numbers from the given sequence.
```python
copyprimes([10, 11, 12, 13, 14, 15])  # [11, 13]
```

#### `deleteprimes(lst: list) -> None`
Removes all prime numbers from the given list (modifies in place).
```python
nums = [10, 11, 12, 13, 14, 15]
deleteprimes(nums)
print(nums)  # [10, 12, 14, 15]
```

#### `withoutprimes(seq: list) -> list`
Returns a new list with all prime numbers removed.
```python
withoutprimes([10, 11, 12, 13, 14, 15])  # [10, 12, 14, 15]
```

#### `isprime(number: int) -> bool`
Checks if a number is prime.
```python
isprime(11)  # True
isprime(10)  # False
```

#### `isprimes(seq: list) -> bool`
Checks if all numbers in the sequence are prime.
```python
isprimes([11, 13, 17])  # True
isprimes([11, 14, 17])  # False
```

#### `nextprime(number: int) -> int`
Finds the next prime number greater than the given number.
```python
nextprime(10)  # 11
```

#### `prevprime(number: int) -> int | None`
Finds the largest prime number smaller than the given number.
Returns `None` if there is no previous prime.
```python
prevprime(10)  # 7
prevprime(2)   # None
```

#### `randprime(start: int, stop: int, count: int = 1, replacement: bool = True) -> list`
Returns a list of random prime numbers in the range `[start, stop)`.  
If `replacement` is `True`, numbers may repeat. Otherwise, unique numbers are selected.
```python
randprime(10, 50, 3)  # Example: [13, 37, 19]
```

#### `primefactors(number: int) -> list | None`
Returns a list of prime factors of a number. Returns `None` for 0, 1, or non-integer values.
```python
primefactors(60)  # [2, 2, 3, 5]
primefactors(13)  # [13]
```

## License

This project is licensed under the MIT License.

```
Copyright 2025 Rishikesh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

