https://github.com/grandmoff100/betternumbers
Different base Numbers with useful methods.
https://github.com/grandmoff100/betternumbers
Last synced: 4 months ago
JSON representation
Different base Numbers with useful methods.
- Host: GitHub
- URL: https://github.com/grandmoff100/betternumbers
- Owner: GrandMoff100
- License: mit
- Created: 2020-12-24T02:04:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-12T22:42:30.000Z (over 4 years ago)
- Last Synced: 2025-01-23T12:15:31.984Z (9 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Better Numbers!
### ``class N`` Methods
Deals with **integers** in all bases greater than one.
> Note: Floats not implemented yet.- ``n.to_base_ten()``
Returns the base ten equivalent of ``n``
- ``n.to_base(self, b: int)``
Return the base ``b`` equivalent of ``n``### ``class N`` Operations
For the following operations, if they are in different bases it returns the result in the base of the first number.
- `` - ``
Subtracts the two numbers.
- `` + ``
Adds the two numbers.
- `` * ``
Multiplies the two numbers.
- `` / ``
Divides the two numbers, and returns an integer.
- `` % ``
Remainder/Modulo function.
- ``abs()``
Return the absolute value of ``n``.
- ``n.op(func, *others)``
Returns the result of ``func(n, *others)``, if other operations aren't enough.
- ``n.is_prime()``
Return the boolean value of if it's a prime or not.