fork download
  1. import numpy as np
  2.  
  3. def divisores(num):
  4. n = np.arange(1,num)
  5. d = num % n
  6. zeros = d == 0
  7. return n[zeros]
  8.  
  9. def divisores_comuns(num1, num2):
  10. divs1 = set(divisores(num1))
  11. divs2 = set(divisores(num2))
  12. return divs1 & divs2
  13.  
  14.  
  15. print(divisores_comuns(15,20))
Success #stdin #stdout 0.13s 25020KB
stdin
Standard input is empty
stdout
{1, 5}