A Python library for more math functions.
Project description
More Math Python Library
An Introduction
Welcome to the More Math Python library!
In this library, you will have many functions that are not in the built-in "math" module.
A Brief Summary of this Module
Basic Functions
Here are some basic functions:
is_prime(number: int) -> bool and is_composite(number: int) -> bool check the primality of a number.
is_square(number: int) -> bool checks whether a number is a square or not.
is_cube(number: int) -> bool checks whether a number is a cube or not.
All numbers in these functions must be greater than 2.
HCF and LCM
hcf(*numbers: int) -> int returns the highest common factor of the numbers.
lcm(*numbers: int) -> int returns the lowest common multiple of the numbers.
Exponents and Roots
is_power_of(number: int, x: int) -> bool: which checks whether number is a power of x.
nth_power_of(number: int, x: int) -> int: which checks which power of x is number.
nth_root_of(number: int, x: int) -> int: which checks which root of x is number.
Combinations
combinations(number: int, *, keep_length: bool = True, repeat: bool = False) -> list[int] generates a list of all possible combinations
with a set of numbers. keep_length and repeat are optional, but they are keyword-only arguments.
keep_length allows you to keep the length of the specified number, and is by default set to True.
repeat allows repeating digits, and is by default set to False.
nth_combination(number: int, index: int, *, keep_length: bool = True, repeat: bool = False) -> int
returns the nth combination generated with a set of numbers. index is n here.
min_and_max_combination(number: int, *, keep_length: bool = True, repeat: bool = False) -> tuple[int]
returns the lowest and highest number generated with a set of digits.
Encoding and Decoding
encode_number(number: int, base: int) -> int encodes the number into an alphanumeric number of a specific base.
decode_number(number: str, base: int) -> int decodes the number from an alphanumeric number of a specific base to an integer.
Other Properties of Numbers (returns bool)
is_triangular(number: int) -> bool returns whether a number is triangular
(=that is a sum of digits from 1 to a number) or not.
is_pentagonal(number: int) -> bool returns whether a number is pentagonal (=that is n(3n+1) / 2) or not.
is_hexagonal(number: int) -> bool returns whether a number is hexagonal (=that is n(2n+1)) or not.
is_strong(number: int) -> bool returns whether the sum of factorials of the digits of a number add up to the number.
is_armstrong(number: int) -> bool returns whether the sum of cubes of the digits of the number add up to the number.
is_mersenne_prime(number: int) -> bool returns whether a number is a Mersenne prime or not.
A Mersenne prime is a prime number which is 1 plus a power of 2.
Exceptions
Exceptions are raised in many of the functions when you enter a number that is less than 1.
They are also raised in nth_power_of(number: int, x: int) -> bool when you enter
number when it is not a power of x.
How to Install the Module
- Open your terminal or command line
- Run
pip install more_math_3. - Add it to your PATH.
Thank you! I hope you like my module. Reach out to me here: unknownuser170911@gmail.com Enjoy using the module!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file more_math3-1.0.tar.gz.
File metadata
- Download URL: more_math3-1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c8929a2e1697a17c085b23da96e8d213dbc500d6692878248fee134c7eb3af2
|
|
| MD5 |
66abb48d3b6d176fd19df26bb436a34b
|
|
| BLAKE2b-256 |
6c3ce341218112e105f36cf93fa6084070b78b4480a72414de551d8c9284318d
|
File details
Details for the file more_math3-1.0-py3-none-any.whl.
File metadata
- Download URL: more_math3-1.0-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
830fd9bfcc8ef8c205075ce01253e9b886f0ff9d6940d145142a21ce2d00483a
|
|
| MD5 |
158197739d532e3e29c69f3e572bc011
|
|
| BLAKE2b-256 |
316dc81c94b3d6a8fd7102bc00e00427d1e7d4e1abd02d2d6fbc9ed16d345dd1
|