defDirectoryAttack(A,B=[]):iflen(B)<1:B=Aforiinxrange(0,len(A)):forjinxrange(0,len(B)):ijgcd=gcd(A[i],B[j])if(ijgcd>1)and(A[i]!=B[j]):print("The common factor of {0} and {1} is {2}".format(A[i],B[j],ijgcd))
DirectoryAttack([1,2,3],[3,6,7])
The common factor of 2 and 6 is 2
The common factor of 3 and 6 is 3