Determine if two integers are coprime.
Parameters |
a : Int First integer.
b : Int Second integer
|
---|---|
Returns |
bool : Boolean true if a, b are coprime, false otherwise.
|
Errors |
This function does not raise any errors. |
Factors an integer, n, into its prime factors and puts them into an array.
Parameters |
n : Int The number to factor.
|
---|---|
Returns |
arr : Array The prime factors of n.
|
Errors |
This function does not raise any errors. |
Determines if an integer, n, is a perfect power. It should be noted that this does not find the minimum value of k where m^k = n for some m.
Parameters |
n : Int The number to test.
|
---|---|
Returns |
arr/bool : Array/Boolean Returns [m,k] if n is a perfect power, returns false otherwise.
|
Errors |
This function does not raise any errors. |
Determines if an integer, n, is a prime power (n = p^m). The prime and the power are returned if so.
Parameters |
n : Int The number to test.
|
---|---|
Returns |
arr/bool : Array/Boolean Returns [p,m] if n is a perfect power, returns false otherwise.
|
Errors |
This function does not raise any errors. |
Determines if an integer, n, is prime in polynomial time using the Miller-Rabin primality test, with an accuracy rate (number of trials) k.
Parameters |
n : Int The number to test for primality.
k : Int The accuracy rate.
|
---|---|
Returns |
bool : Boolean true if n is prime, false otherwise.
|
Errors |
This function does not raise any errors. |
Creates an array of prime numbers from 2 to n, inclusive.
Parameters |
n : Int The largest prime number to be returned.
|
---|---|
Returns |
arr : Array An array of primes from 2 to n.
|
Errors |
This function does not raise any errors. |
Determines if an integer, n, is prime using brute force.
Parameters |
n : Int The number to test for primality.
|
---|---|
Returns |
bool : Boolean true if n is prime, false otherwise.
|
Errors |
This function does not raise any errors. |