A CLI tool to check if any ints in a list are prime and print their factors, or to print all primes up to n.
Clone the repo, cd into the directory, and install with pip install .
The cli command for the program is pprime
(mnemonic for 'py-prime').
Pass any number of ints as positional arguments and the program will print them back in color. All primes are green, all composites are red.
By default, the program sorts the list before it prints it back, but this can be overridden with the -U
flag.
By default, the program will print out the sorted set of unique factors of any composite integer. When the -G
flag is set, the factors will be grouped into their factor pairs.
Setting the -P
flag prints the prime factors of the integer rather than the composite factors.
Pass the -N
flag followed by an int to print all primes up to that number.
Simplify any nth-root radical with -rs {nth} {base}
by factoring out all perfect squares. The radical terms are formatted root{nth}{base}
. For example, 3(root(3)(6))
is equivalent to 3 * ∛6
The program's Test
class is intended to be used for testing with pytest
. The two functions are checked against a list of the first ten-thousand primes as well as each other. To run the tests, clone the repo, cd into the directory, and run pytest
in the terminal.