Solution to Common-Prime-Divisors by codility

18 Feb

Question: https://codility.com/demo/take-sample-test/common_prime_divisors

Question Name: CommonPrimeDivisors

11 Replies to “Solution to Common-Prime-Divisors by codility

  1. Thank you for explanation.
    BTW, this code can be refactored – put copy-pasted block for x_gsd and y_gsd into separate method.

  2. Why a refactor is necessary here? Didn’t get chance to see your original code though…

  3. This solution has a false positive as does the Codilitytest, ([1],[1]). So in every set of values where 1,1, exists this solution returns the wrong answer.
    1 is not a prime number!

  4. Python version:

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!