Skip to main content

An demonstration of how to implement Gaussian Integer operations in Python.

Project description

It is easy to take the unique factorization property for granted, but with more experience we will see that this gift is not something which had to happen. Among the similar “integers” that are dealt with in the advanced topics of number theory there are examples with unique factorization (for example the Gaussian integers, Z[i]) and conversely there are examples where unique factorization fails (for example Z[√-5], where the otherwise perfectly well behaved integer 6 has as prime factorizations both 6 = (2)(3) and a second one 6 = (-1)(1+√-5)(1-√-5)).

The package PyKhana contains a method implemented entirely in Python3. It can be used to implement Gaussian Integer Numbers.

Gaussian Integer functions. Functions implemented are: Arithmetic functions: +,*,//,%,**(exponentiation) a.gcd(b) - Compute the greatest common divisor of a and b. a.xgcd(b) - Extended gcd - return gcd(a,b) and x,y such that gcd(a,b)=xa+yb. n.isprime() - Is n prime (pseudoprime tests) n.factor() - Return a factor of n. n.factors() - Return list of the factors of n. Gaussian Integers can be created by: n = GaussInt(5,7) # Create (5 + 7i) n = GaussInt(13) # Create (5 + 0i) z = complex(2,3); n = GaussInt(z) # Round the complex number to integer form

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyKhana-0.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyKhana-0.0.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file PyKhana-0.0.3.tar.gz.

File metadata

  • Download URL: PyKhana-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for PyKhana-0.0.3.tar.gz
Algorithm Hash digest
SHA256 de3b300ab79423190709206a9877f1a13479ce459db17c39f08b03ca553e51dd
MD5 9a1c42b4aa42f13dbcc9b600f9b5dcd6
BLAKE2b-256 a4daa099cf97634f811fb6a22097dd2d71bb79d941c93a62282e4e503bd4ef95

See more details on using hashes here.

File details

Details for the file PyKhana-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: PyKhana-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for PyKhana-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b2731c13c0f5bfe56565200474a400e3bb96bb34a32fe9dd04ef4d5b5e6ef690
MD5 3eef9e628129b2a23a6e97e7c85edfdc
BLAKE2b-256 8cdb4d6447c1cc239ab57ddb0e83cf818d19a90c2894dfebe45cfb9d4e249b8b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page