semvec/pypi-packages huggingface dataset:
number-theory-primes 0.1.2
Advanced primality testing algorithms including AKS
Requires Python: >=3.8

# Primes - Advanced Primality Testing Algorithms

A Python library implementing state-of-the-art primality testing algorithms, starting with the AKS (Agrawal-Kayal-Saxena) primality test.

## Overview

This repository contains implementations of various primality testing algorithms with a focus on theoretical significance and practical applications. The AKS primality test is the first deterministic polynomial-time algorithm for testing primality.

## Features

- **AKS Primality Test**: First deterministic polynomial-time primality test
- **Comprehensive Documentation**: Detailed explanations of algorithms and mathematical foundations
- **Performance Analysis**: Benchmarking and complexity analysis
- **Examples and Tutorials**: Step-by-step examples demonstrating algorithm usage

## Installation

```bash
pip install -e .
```

## Quick Start

```python
from primes.aks import AKSPrimalityTest

# Create an instance of the AKS test
aks = AKSPrimalityTest()

# Test if a number is prime
result = aks.is_prime(31)
print(f"31 is prime: {result}")  # True

# Get detailed step-by-step execution
result_detailed = aks.is_prime_detailed(31)
print(result_detailed)
```

## Algorithms Implemented

### AKS Primality Test
- **Time Complexity**: O(log^6 n) (theoretical), optimized versions available
- **Space Complexity**: O(log^3 n)
- **Deterministic**: Yes
- **Paper**: [PRIMES is in P](https://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf)

## Project Structure

```
primes/
├── src/
│   └── primes/
│       ├── __init__.py
│       ├── aks/
│       │   ├── __init__.py
│       │   ├── core.py
│       │   └── optimizations.py
│       └── utils/
│           ├── __init__.py
│           ├── math_utils.py
│           └── polynomial.py
├── tests/
│   ├── __init__.py
│   ├── test_aks.py
│   └── test_utils.py
├── examples/
│   ├── basic_usage.py
│   ├── performance_comparison.py
│   └── step_by_step_aks.py
├── docs/
│   ├── algorithms/
│   │   └── aks.md
│   └── mathematical_foundations.md
├── benchmarks/
│   └── aks_benchmark.py
├── requirements.txt
├── setup.py
└── README.md
```

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## References

1. Agrawal, M., Kayal, N., & Saxena, N. (2004). PRIMES is in P. Annals of Mathematics, 160(2), 781-793.
2. [AKS Primality Test - Wikipedia](https://en.wikipedia.org/wiki/AKS_primality_test)

## Acknowledgments

- Inspired by the VaidhyaMegha/optimization_algorithms repository structure
- Mathematical foundations based on the original AKS paper
pluralize 20250901.2
i18n + pluralization library with multi-plural form support and thread safe for web apps
Requires Python: >=3.7

# Pluralize

Pluralize is a Python library for Internationalization (i18n) and Pluralization.

The library assumes a folder (for exaple "translations") that contains files like:

```sh
it.json
it-IT.json
fr.json
fr-FR.json
(etc)
```

Each file has the following structure, for example for Italian (it.json):

```json
{"dog": {"0": "no cane", "1": "un cane", "2": "{n} cani", "10": "tantissimi cani"}}
```

The top level keys are the expressions to be translated and the associated value/dictionary maps a number to a translation.
Different translations correspond to different plural forms of the expression,

Here is another example for the word "bed" in Czech

```json
{"bed": {"0": "no postel", "1": "postel", "2": "postele", "5": "postelí"}}
```

To translate and pluralize a string "dog" one simply wraps the string in the T operator as follows:

```python
>>> from pluralize import Translator
>>> T = Translator('translations')
>>> dog = T("dog")
>>> print(dog)
dog
>>> T.select('it')
>>> print(dog)
un cane
>>> print(dog.format(n=0))
no cane
>>> print(dog.format(n=1))
un cane
>>> print(dog.format(n=5))
5 cani
>>> print(dog.format(n=20))
tantissimi cani
```

The string can contain multiple placeholders but the {n} placeholder is special because
the variable called "n" is used to determine the pluralization by best match (max dict key <= n).

T(...) objects can be added together with each other and with string, like regular strings.

T.select(s) can parse a string s following the HTTP accept language format.

## Update the translation files

Find all strings wrapped in T(...) in .py, .html, and .js files:
```python
matches = T.find_matches('path/to/app/folder')
```

Add newly discovered entries in all supported languages
```python
T.update_languages(matches)
```

Add a new supported language (for example german, "de")

```python
T.languages['de'] = {}
```

Make sure all languages contain the same origin expressions
```python
known_expressions = set()
for language in T.languages.values():
    for expression in language:
        known_expressions.add(expression)
T.update_languages(known_expressions))
```

Finally save the changes:

```python
T.save('translations')
```