I have an array of size n. I need to find the GCD of each element with a given number and if it\'s greater than 1, add it to another array. What\'s the fastest way to do thi
For small numbers use binary GCD (which is faster Euclid's GCD algorithm) & for large numbers try Lehmer's algorithm.
Binary GCD: https://www.google.com/amp/s/www.geeksforgeeks.org/steins-algorithm-for-finding-gcd/amp/