Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think the questioner means this: given a list of integers N each of the form N=p*q with p,q prime, he/she wants to find common factors of pairs of the Ns, so to take their GCDs in pairs. This works (after assigning your list of integers to the variable Ns):

sage: gcds = [GCD(N1,N2) for N1 in Ns for N2 in Ns if N1!=N2]
sage: [g for g in gcds if g>1]

but there are certainly more efficient ways.