Skip to main content

Prints addition and multiplication tables for Z mod n*Z

Project description

About mod-table

mod-table prints the addition and multiplication tables for the ring of integers modulo n, denoted ℤ/nℤ - and ℤ/nℤ is a field if and only if n is prime.

Installing mod-table

    python3 -m pip install modTable --upgrade

It's recommended to install into a local venv, or if installing systemwide as the super-user to make a venv in /usr/local/venv, and install it there. For some helpful hints about how to do this see the addendum in the lsseq repo.

Testing mod-table

Running mod-table on the command line should show you this.

$ mod-table 5
ℤ/5ℤ
 + |  0  1  2  3  4 
--------------------
 0 |  0  1  2  3  4 
 1 |  1  2  3  4  0 
 2 |  2  3  4  0  1 
 3 |  3  4  0  1  2 
 4 |  4  0  1  2  3 

 * |  0  1  2  3  4 
--------------------
 0 |  0  0  0  0  0 
 1 |  0  1  2  3  4 
 2 |  0  2  4  1  3 
 3 |  0  3  1  4  2 
 4 |  0  4  3  2  1 

$ mod-table 6
ℤ/6ℤ
 + |  0  1  2  3  4  5 
-----------------------
 0 |  0  1  2  3  4  5 
 1 |  1  2  3  4  5  0 
 2 |  2  3  4  5  0  1 
 3 |  3  4  5  0  1  2 
 4 |  4  5  0  1  2  3 
 5 |  5  0  1  2  3  4 

 * |  0  1  2  3  4  5 
-----------------------
 0 |  0  0  0  0  0  0 
 1 |  0  1  2  3  4  5 
 2 |  0  2  4  0  2  4 
 3 |  0  3  0  3  0  3 
 4 |  0  4  2  0  4  2 
 5 |  0  5  4  3  2  1 

See how ℤ/6ℤ can't be a field because 2, 3 and 4 don't have multiplicative inverses. That is, there's no other number that when multiplied by 2, 3 or 4 gives 1.

But in ℤ/5ℤ all the non-zero numbers have multiplicative inverses, so it is a field!

Time to play - Enjoy!

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

modtable-2.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

modTable-2.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file modtable-2.0.1.tar.gz.

File metadata

  • Download URL: modtable-2.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.20

File hashes

Hashes for modtable-2.0.1.tar.gz
Algorithm Hash digest
SHA256 bb421060211bc5404aa0618ae4ac36d82267275267fe8f6495d66fb9fe8e1556
MD5 67f6706e147b16800c12c713470c2247
BLAKE2b-256 4cb8f94465d506415b8597d3357e3f8aa124b4acdb5f358957118578225da754

See more details on using hashes here.

File details

Details for the file modTable-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: modTable-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.20

File hashes

Hashes for modTable-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af0287cb7f26f74fb54ce23504286b1a6cea662ebd05e9adfaf774308ec49bba
MD5 d8d1023e690b78f9bf88ffeca90a16d8
BLAKE2b-256 f41a4e48ccebed4737bf41e0e62c319d613ae68dd74eef122f65b9b9eaccfb53

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