Skip to main content

Batch GCD

Overview

A pure Python implementation of DJB's Batch GCD algorithm.

Installation

Download and install with pip.

Or, download from source and install with make install (standard, user) or make install_dev (editable, system).

Usage

This is a library and cannot be invoked directly.

Test with make test.

The batch_gcd module exposes a batch_gcd function which takes integers and returns a list of their GCDs at the corresponding index.

>>> # Example batch_gcd usage
>>> from batch_gcd import batch_gcd
>>> batch_gcd(1909, 2923, 291, 205, 989, 62, 451, 1943, 1079, 2419)
[1909, 1, 1, 41, 23, 1, 41, 1, 83, 41]

This calculation involves two intermediate steps: creating a product tree and creating a remainder tree. These functions are also exposed, as products and remainders. products take integers and returns a product tree, remainders takes an integer and a product tree and returns a list of remainders.

Resources

Metadata

Release files for batch-gcd 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for batch-gcd 0.0.3
File Size Uploaded
batch_gcd-0.0.3.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for batch-gcd 0.0.3
File Interpreter ABI Platform
batch_gcd-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / batch_gcd-0.0.3.tar.gz

Download URL batch_gcd-0.0.3.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
464877da7b4d6712fee740168eafc1ba51f588f24b990b811b5fe2d7c7046735
BLAKE2b-256 checksum
How to use checksums
b4fae23656ed3ca680b22e5378976587fdce6771e0977bed90a731a78ad6a324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / batch_gcd-0.0.3-py3-none-any.whl

Download URL batch_gcd-0.0.3-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5401886dc107138dac7a6406158eb3930ac6528b10d51dc7653e8cfdff1cbae0
BLAKE2b-256 checksum
How to use checksums
1fc64718613f39f8a84c636c0e94257f5a7e0135ae9d77415d2b70cb46d46c13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page