Package-level declarations
Functions
Two numbers are co-prime when the GCD of the numbers is 1. This method uses an algorithm called the Euclidean algorithm to compute GCD.
The method computes the greatest common divisor of two numbers by recursively applying the Euclidean algorithm: gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b)
The least common multiple is found out by using the principle that lcm(a, b) = (a * b) / gcd(a, b)
Generates a random prime number within range, using isPrime() function to check for primality.
Gets all primes until the limit by checking whether every number in the loop is a prime number.
Uses a method called sieve of Eratosthenes to get all prime numbers until the limit. Works by adding all the numbers in an arraylist first and then removing all the multiples of every single number in that list.
Recursively raises a number to a certain power. This method returns the original number is power is 1, otherwise multiplies the number on the result of calling itself with decremented power. This means that the number will be multiplied on itself (the original) n amount of times, where n is the power.
Iteratively raises a number to a certain power. For description refer to the method above.
Returns all co-primes starting from 1 of a number, where limit is the biggest number to be checked for coprimality.