Metadata-Version: 2.1
Name: modular-towers
Version: 0.1
Summary: An algorithm that computes modular nested exponents (or towers) efficiently.
Home-page: https://github.com/avivbrook/modular-towers
Author: Aviv Brook
Author-email: avbrook@ucsc.edu
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/avivbrook/modular-towers/issues
Project-URL: CI, https://github.com/avivbrook/modular-towers/actions
Keywords: modular exponentiation,nested exponentiation
Platform: any
Classifier: Framework :: Jupyter
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: sympy

# modular-towers

An algorithm that computes modular nested exponents (or towers) efficiently.

## 🚩 Table of Contents

- [Overview](#%EF%B8%8F-overview)
- [Installing](#-installing)
- [Examples](#-examples)

## 🗺️ Overview

`modular-towers` exports a Python function `mod_tower` that takes as input an arbitrarily long sequence of positive integers `a₁, a₂, ..., aₙ` and a positive integer `m` and computes `a₁^(a₂^(···^aₙ)) mod m` efficiently (that is, without computing the value of the nested exponent).

## 🔧 Installing

Installing with `pip` is the easiest:
```console
$ pip install modular-towers
```

A development version can be installed from GitHub
using `setuptools`, provided you have `sympy` installed already:
```console
$ git clone https://github.com/avivbrook/modular-towers
$ cd modular-towers
$ python setup.py install
```

## 💡 Examples

```python
>>> from modular_towers import mod_tower as modtow
>>> modtow([6,5,4,3,2], 1948502738) # 6^(5^(4^(3^2))) mod 1948502738
951546056
```

